-
-
Notifications
You must be signed in to change notification settings - Fork 35k
Fix availability for manual trigger entities #128054
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks @flo-wer I added those to be fixed by this PR and while this isn't specifically only for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For non-trigger template entities, we added the concept of "super template" which is always the availability template and which:
- Is rendered first
- Suppresses rendering of other templates if it's false
Can we do something similar here?
Also, we should preferably add direct tests of ManualTriggerEntity
.
The existing test is in tests/components/template/test_manual_trigger_entity.py
, it should be moved to tests/helpers/test_trigger_template_entity.py
d9eada0
to
2576e52
Compare
1c03cde
to
2e2c718
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, some questions though.
Also, we should make sure the way the availability template suppresses rendering of other templates is documented, both for the trigger case and for the state case.
except TemplateError as err: | ||
logging.getLogger(f"{__package__}.{self.entity_id.split('.')[0]}").error( | ||
"Error rendering %s template for %s: %s", key, self.entity_id, err | ||
) | ||
self._render_error = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a significant difference between state and trigger based templates.
If a state availability template fails to render, it assumes it's available
If a trigger availability template fails to render, it will go unavailable
.
This PR does not change this behavior from before, but it's a notable difference on behavior which should be addressed.
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. |
I think this PR is no longer needed thanks to the changes in #140660, and I suggest we close it |
Proposed change
Fix
ManualTriggerEntity
to not write state before calculating availability.Fair share of tests added.
Type 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: