Repository navigation
Conversation
Services registered while Home Assistant starts are missing from the list fetched on connect. Fetch them again after waiting for startup, before the plugin reports it started. Co-Authored-By: Claude Opus 5.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.
The Problem
When AppDaemon connects while Home Assistant is still starting, it fetches the service list right away. Services that Home Assistant registers later in its startup, such as
weather/get_forecasts, are missing from that list.call_plugin_serviceuses the list to decide whether to sendreturn_response=True, so apps that call such a service right after startup get it rejected until the next periodic refresh, which runs everyservices_sleep_time(60 s by default):WARNING HASS: Error with websocket result: service_validation_error: Validation error: The action requires responses and must be called with return_response=True: request={'type': 'call_service', 'domain': 'weather', 'service': 'get_forecasts', ...}The Solution
In
__post_auth__, after the plugin has waited for Home Assistant to start, it fetches the service list once more. This happens beforenotify_plugin_started, so apps start with the full list. If Home Assistant is already running when AppDaemon connects, the plugin does not wait, and no extra request is sent.What to Review
appdaemon/plugins/hass/hassplugin.py: theget_hass_services()call inside theif not self.is_ready:block.tests/unit/test_hass_startup.py: a new unit test. It calls__post_auth__on a mock plugin and checks the order of calls in both cases. In the first case, Home Assistant is still starting: wait, then fetch services, then report started. In the second case, Home Assistant is already running: report started, with no extra fetch.docs/HISTORY.md: a new entry under 4.5.14 Fixes.