-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
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
Error logged while rounding missing humidity values on device registration #131837
Comments
Hey there @OttoWinter, @jesserockz, @kbx81, @bdraco, mind taking a look at this issue as it has been labeled with an integration ( Code owner commandsCode owners of
(message by CodeOwnersMention) esphome documentation |
Why is the value |
Because the ESPHome device doesn't have a physical sensors, the climate component on the ESP32 gets its humidity value from a Home Assistant sensor component, then reports the same value back to HA as an attribute of the climate entity. I think that the ESPHome integration in HA probably has to register the ESPHome device before it can supply it with the current reading, so the climate entity in HA is initialized with missing values. Registration is mentioned in the HA error log. I've checked the ESP32 device logs, and as far as I can tell, it doesn't seem to be a case of the ESP32 actually outputting a NaN. I would guess that the same thing happens with temperature (another value imported to the ESP32 from HA), but doesn't cause problems because temperature is |
I checked the ESPHome logs in more detail. In my setup, the ESPHome thermostat climate component
|
The problem
The climate integration logs errors when an ESPHome climate device that takes a humidity input from Home Assistant is restarted. The error appears to occur because the humidity value unknown at startup. The ESPHome integration in Home Assistant sets the
current_humidity
attribute of theclimate
entity tonan
. When Home Assistant tries to read this value, the ESPHome integration tries to round it to an integer result. Asnan
is afloat
, this throws an error.What version of Home Assistant Core has the issue?
core-2024.11.3
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
ESPHome
Link to integration documentation on our website
https://www.home-assistant.io/integrations/esphome/
Diagnostics information
config_entry-esphome-01JDS82XRM5QPX250XAJFJJG18.json
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
The cause of the issue seems to be in the getter function for the
current_humidity
method, which is supposed to return anint
:core/homeassistant/components/esphome/climate.py
Line 238 in 474544a
It either needs to return
None
whenself._state.current_humidity
isnan
, or perhaps return afloat
rather than anint
(I'm not sure what propagating thenan
would do in the latter case.Adding this code before the final
return
statement might fix it:The text was updated successfully, but these errors were encountered: