Hi, everyone!
This week I noticed, some my esphome devices with sensors has problems with cooenctivity via api with Home Assistant.
Some of them has different time of last update. Even if two sensors are on same esp, last update may differs.
For example, esp in kitchen updated temperature 30 seconds ago and humidity updated 5 (!!!) minutes ago.
Sometimes thay updated simultaneously.
I cant figure out the reason.
I’ve got an idea. How about restart ESP, if last update of sensors was more than 5 minutes ago.
I wrote automation:
[11:17:40][D][dht:048]: Got Temperature=28.5°C Humidity=52.0%
[11:17:40][D][sensor:125]: 'Kitchen Temperature': Sending state 28.50000 °C with 1 decimals of accuracy
[11:17:40][D][sensor:125]: 'Kitchen Humidity': Sending state 52.00000 % with 0 decimals of accuracy
[11:18:40][D][dht:048]: Got Temperature=28.5°C Humidity=53.0%
[11:18:40][D][sensor:125]: 'Kitchen Temperature': Sending state 28.50000 °C with 1 decimals of accuracy
[11:18:40][D][sensor:125]: 'Kitchen Humidity': Sending state 53.00000 % with 0 decimals of accuracy
[11:19:40][D][dht:048]: Got Temperature=28.5°C Humidity=53.0%
[11:19:40][D][sensor:125]: 'Kitchen Temperature': Sending state 28.50000 °C with 1 decimals of accuracy
[11:19:40][D][sensor:125]: 'Kitchen Humidity': Sending state 53.00000 % with 0 decimals of accuracy
[11:20:40][D][dht:048]: Got Temperature=28.5°C Humidity=53.0%
[11:20:40][D][sensor:125]: 'Kitchen Temperature': Sending state 28.50000 °C with 1 decimals of accuracy
[11:20:40][D][sensor:125]: 'Kitchen Humidity': Sending state 53.00000 % with 0 decimals of accuracy
ESP sending data every minute.
But in web HA last update temperature and humidity was 5 minutes ago.
Last updated won’t change if the new state value is the same as the current value. See the description of last updated here: State Objects - Home Assistant
Your device is working fine. It’s sending updated that HA receives every minute.
I would recommend you change the DHT config to use the actual device model rather than auto detect though. That has caused some people issues in the past.