New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add config reloaded events for automation and scene #34664
Conversation
Hey there @home-assistant/core, mind taking a look at this pull request as its been labeled with a integration ( |
48cc1ab
to
3b380cd
Compare
Stripped down this PR to its bare basics, limiting its scope, rebased it, and added documentation. |
It looks like an unrelated test failure to me. |
That's unrelated indeed. That's flakiness caused by the background PR. |
Fix for the flaky test #36358 |
Proposed change
This PR is adding events when automations or scenes might have been reloaded (and thus might have been changed).
Reasoning and use case:
Automations (and others) can be changed on the fly. Either via UI editing, UI reloading or by reloading YAML configuration via, e.g., the
automation.reload
service.Triggers fire, conditions are checked and actions follow. The beautify of this is that automations can be used to bring your home into a state automatically.
Consider this automation:
The Home Assistant start is used here to ensure the state of the light is correct if Home Assistant starts (nb: Due to recent changes, that is not as viable anymore... but not the point 馃槈).
This is nice and all, but if automation gets changed, we need a manual trigger or re-apply manually, instead of it just happing (if automation is set up that way).
The same can be done for e.g., a scene. If a scene changes, the automation can re-trigger applying the changed/updated scene.
With the change in the PR, is becomes possible for an automation to listen for the updated event, after which it can trigger and re-evaluate conditions and/or re-apply changes in the automation automatically.
This PR only applies to scenes and automations. In all other cases, it will cause entities to fire a change on entity level, which will just work as we are used to.
Type of change
Example entry for
configuration.yaml
:# Example configuration.yaml
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale: