history_stats: Accidentally passing in state: on
(boolean) instead of state: "on"
(string) always results in 0.0 value
#121045
Labels
The problem
If you mistakenly put
state: on
instead ofstate: "on"
in your config, YAML parses that as the valueTrue
.It seems like we just compare the recorded state against the boolean, which never matches so the statistic always calculates to
0.0
.According to the history_stats docs,
state
should be alist|string
, so this seems like invalid state. Something should probably validate the configured state. (It also seems like state object states are always strings, so it's never valid to allow a boolean. I'm new to HA so I could be wrong here, though.)What version of Home Assistant Core has the issue?
2024.4.4
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
history_stats
Link to integration documentation on our website
https://www.home-assistant.io/integrations/history_stats/
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response
The text was updated successfully, but these errors were encountered: