core: min_max doesn't wait for template entities to be ready
The problem
At startup, the min_max integration throws errors on entities which are template sensors. After startup, the integration does its job alright, and creates the ( in this case) average temperature based on the configuration
Environment
- Home Assistant Core release with the issue: 116.4
- Last working Home Assistant Core release (if known): not sure, but never saw this error before 116
- Operating environment (OS/Container/Supervised/Core): OS
- Integration causing this issue: Min max
- Link to integration documentation on our website: https://www.home-assistant.io/components/sensor.min_max/
Problem-relevant configuration.yaml
# https://www.home-assistant.io/components/sensor.min_max/
- platform: min_max
name: Mean indoor temp
type: mean
entity_ids:
- sensor.temperatuur_living
- sensor.dining_table_sensor_calibrated_temperature
- sensor.auditorium_sensor_calibrated_temperature
- sensor.frontdoor_sensor_calibrated_temperature
- sensor.library_sensor_calibrated_temperature
- sensor.dorm_sensor_calibrated_temperature
- etc etc
these calibrated sensors are based on the core HUE sensors:
dining_table_sensor_calibrated_temperature:
friendly_name: Dining table calibr temp
value_template: >
{{(states('sensor.dining_table_sensor_temperature')|float +
states('input_number.temp_calibration')|float)|round(2)}}
unit_of_measurement: °C
device_class: temperature
Traceback/Error logs
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 254, in _async_state_change_dispatcher
hass.async_run_job(action, event)
File "/usr/src/homeassistant/homeassistant/core.py", line 384, in async_run_job
target(*args)
File "/usr/src/homeassistant/homeassistant/components/min_max/sensor.py", line 164, in async_min_max_sensor_state_listener
if new_state.state is None or new_state.state in [
AttributeError: 'NoneType' object has no attribute 'state'
Additional information
happening on reload of template entities too
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (14 by maintainers)
tbh, I would hope for senior dev’s that aren’t happy to scrutinize people at all, privately or publicly.
What I expected was some help ‘getting this some attention’, not for you to solve it in any way, right away.
Also, since you yourself were already in this conversation since oct 2020, I didnt think the harmless tag would be very ‘impolite’.
I can see through the unnecessary abusive words you use, and do understand you don’t want to be tagged al day long, by anyone, and I respect that. Goes without saying.
So, I don’t want a warning at all, I expect some mutual respect, because that has 2 be bi-directional.
Enough said. I’ll be glad to have a go at the issue at hand, but, I would need guidance and help for that. Ultimately, that was what I was looking for, either assist in the notion of the bug, and/or be a part of a solution. I have no high hopes of the latter because of my skills on the subject though.
I would rather close this because of the discussion on the matter of the tag, but the core issue is still open, so I can’t.
Hope to clear the air with this.
wow, very helpful. thanks.