Closed Mariusthvdb closed 2 months ago
Hey there @dgomes, mind taking a look at this issue as it has been labeled with an integration (utility_meter
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
utility_meter documentation utility_meter source (message by IssueLinks)
I have the feeling that these errors are generated because the template sensor is receiving state "unknown" while it is expecting is_number(). Is this where the template_available option is designed for and should be used inside our custom template sensors?
This has nothing to do with template sensors. This is being reported by the Utility Meter integration. Template sensors would cause the Utility Meter to report this if you use the availability:
template option but that is beside the point.
e.g. I have a bunch of zigbee smart plugs (no templates) that report the same thing after I restart the mqtt addon or host machine (e.g. for an OS update):
Logger: homeassistant.components.utility_meter.sensor Source: components/utility_meter/sensor.py:502 integration: Utility Meter (documentation, issues) First occurred: 07:48:22 (12 occurrences) Last logged: 07:48:22
Electronics Bench Energy Daily received an invalid new state from sensor.electronics_bench_energy : unknown Cinema Subwoofer Energy Daily received an invalid new state from sensor.cinema_subwoofer_energy : unknown Workshop Fridge Energy Daily received an invalid new state from sensor.workshop_fridge_energy : unknown Electric Blanket Energy Daily received an invalid new state from sensor.electric_blanket_energy : unknown Washing Machine Energy Daily received an invalid new state from sensor.washing_machine_energy : unknown
The main gripe I have is that unknown
is not "an invalid new state" It is a required state to to prevent the utility meter doing incorrect things.
If the utility meter sees some_value
→ 0
→ some_value
it will add the 0
→ some_value
step. This will not occur if the device reports some_value
→ unknown
→ some_value
.
In short unknown
should not be reported as an "an invalid new state".
it is invalid...
what should happen is for the source sensor to go unavailable and back to available.
So is the buck being passed to home assistant core or Zigbee2mqtt for setting the states to unknown
instead of unavailable
when the the host machine is shut down for an OS upgrade?
when zigbee2mqtt disconnects, all its entities should change state to unavailable - which is literally what's going on
in my case, I dont use zigbee2mqtt, my issue is about core Mosquito Mqtt entities.
however, I just reloaded Mqtt and checked, and the reported logging is no longer there using default:
logger set to warning or error.
was this fixed after all? (currently HA 2024.6.3)
The warning is still there in the code... so you fixed things in another way...
The warning is still there in the code... so you fixed things in another way...
haha, I did no such thing. both my mqtt and utility_meter configs are untouched. there was nothing I could do. not complaining though cheers
Yeah it's not fixed and should not have been closed.
The problem
Source sensors are direct Mqtt topic sensors, example below.
since the user can not guard this with some availability template in Utility meter (or the source for that matter as it is a direct Mqtt topic, and has no availability topic), the warning is not very helpful, off setting even as it makes the user want to fix this.
(maybe move to debug?)
What version of Home Assistant Core has the issue?
2024.4.0.dev20240314
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
Utility meter
Link to integration documentation on our website
https://www.home-assistant.io/integrations/utility_meter
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
fwiw, all of these have the always available on the configuration :