Migrate async_conditions_from_config to ConditionChecker#169033
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates condition.async_conditions_from_config from returning a plain function to returning a ConditionChecker implementation so that lifecycle methods (notably async_unload) can be forwarded to child conditions.
Changes:
- Update
async_conditions_from_configto return a newConditionsChecker(subclassingCompoundConditionChecker) instead of a closure. - Implement
ConditionsCheckerto AND child checks while logging warnings onConditionError(matching previous behavior). - Add tests to verify
async_unloadforwarding forasync_conditions_from_config, including nested compound conditions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| homeassistant/helpers/condition.py | Introduces ConditionsChecker and changes async_conditions_from_config to return it. |
| tests/helpers/test_condition.py | Adds coverage for async_unload forwarding behavior of async_conditions_from_config. |
21 tasks
arturpragacz
requested changes
Apr 24, 2026
Contributor
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
arturpragacz
requested changes
Apr 24, 2026
arturpragacz
approved these changes
Apr 24, 2026
| """Condition checker that ANDs multiple conditions. | ||
|
|
||
| Used by automations and template entities. Unlike AndConditionChecker, | ||
| this logs warnings on errors instead of raising, and uses "condition" |
Member
There was a problem hiding this comment.
Maybe specify where the errors happen and are now caught? Looks like the change was done on unload.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Proposed change
Migrate
async_conditions_from_configtoConditionCheckerThe migrated conditions forward the
async_unloadcalls to their childrenType of change
Additional information
Checklist
ruff format 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.To help with the load of incoming pull requests: