Fix config screens ignoring per-instance client certificate and URL#17
Merged
db1996 merged 1 commit intoJul 21, 2026
Merged
Conversation
The plugin config screens built their initial HomeAssistantClient in ClientViewModelFactory from the legacy global settings (remote URL only, legacy client-cert prefs which are cleared after migration to the instance repository). For servers behind mTLS (e.g. Cloudflare client certificates) every request from that client is rejected (HTTP 403), so the registry/entity fetch triggered by pickService() always failed and the entity picker never loaded. Selecting an instance already built a correct per-instance client in changeInstance(), but it was discarded after loading services/entities, so subsequent launchClientOperation calls still used the broken client. Changes: - ClientViewModelFactory now builds the initial client from the active instance (resolveUrl + per-instance cert), falling back to legacy settings when no instance exists. - BaseViewModel.client is now assignable; changeInstance() in the CallService, GetState and OnTriggerState view models stores the per-instance client so all later operations use it. Tested on-device against a Home Assistant instance behind a Cloudflare tunnel with mandatory mTLS: entity lists now load and actions save with a populated entity_id. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16
The config screens' initial
HomeAssistantClientwas built from legacy global settings (remote URL, no per-instance cert), so behind mTLS every registry/entity fetch got a 403 and the entity picker never loaded; actions could then save with an emptyentity_idand fail at runtime with HTTP 400.ClientViewModelFactorynow builds the initial client from the active instance (resolveUrl()+ per-instance cert), falling back to legacy settings.BaseViewModel.clientis assignable;changeInstance()(CallService/GetState/OnTriggerState) keeps the per-instance client for subsequent operations.Built the APK and tested on-device against HA behind Cloudflare mTLS: entity list loads and the saved action runs successfully. Developed with AI assistance (Claude); reviewed and validated end-to-end by me.
🤖 Generated with Claude Code