Open wbyoung opened 2 months ago
Hey there @phracturedblue, @tetienne, @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (template
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
template documentation template source (message by IssueLinks)
The problem
Trigger based sensor entities restore their state, but when restored from an
unavailable
state (or when newly created), they result in a state ofunknown
. Theunknown
state makes sense for when they're newly created, but I'm not sure it makes sense when they're retored.Here's an example that can be debugged by triggering events:
You can set the state by firing the event
_debug_template_state_issues
with data:When you reload template entities, the state is restored as expected.
You can set this to
unavailable
by firing the event_debug_template_state_issues
with data:When you reload template entities, the state becomes
unknown
which is not what it was before.Expected Behavior
I believe they be restored to an
unavailable
state (and not render thestate
oravailability
templates).If you try to fix this to fix by adding a trigger for
event_template_reloaded
, you still get a state change when template entities are reloaded fromunknown
tounavailable
which isn't the most desirable either, so this may be a workaround for some, but also just creates other complications.Tangentially Related
This is only slightly related to https://github.com/home-assistant/core/issues/117397 for me because I was actually trying to add the
availability
option in order to work around the fact that returningnone
has been giving me errors.What version of Home Assistant Core has the issue?
core-2024.9.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Template
Link to integration documentation on our website
https://www.home-assistant.io/integrations/template/#availability
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response