I’m using a D1 Mini Pro and an SHT30 temp/humidity sensor, feeding into Home Assistant and Influx, and visualizing with Grafana. ESPHome will take a temperature reading every time it comes out of deep sleep, and I’m using the deep_sleep parameters to control the frequency of measurements.
In order to have consistent data and get good graphs in Grafana, I want to record each reading in Influx even if the temperature is the same as the previous reading. So I set force_update: True
.
In order to use less power and keep the D1 from getting hot (and interfering with the temp readings), I use deep_sleep to run for 60 seconds and then deep sleep for 10 minutes. The reason to have it run so long is to give Home Assistant a better chance of connecting to ESPHome during its window of being awake.
With this setup, I get phantom data. Every time the Home Assistant ESPHome integration runs its reconnect logic, it calls data.async_update_device_state()
, which in turn calls Home Assistant’s Entity.async_write_ha_state()
. With force_update set, this records a new data point even though there wasn’t actually a measurement. Because of the reconnect logic, I get bogus data at around 6s, 9s, 13s, 22s, 37s, 63s, 63s, 63s, … after the D1 enters deep sleep.
When I set force_update to false, the bogus data is no longer recorded, but then successive actual temperature measurements are also omitted, even though ESPHome is sending them to HA.
So it seems that if I want to use deep_sleep, I have to choose between either getting extra bogus data or missed data points. I’d love any feedback or suggestions.