Read sensor in ESPHome but no need to send to HA immediately

Hi! I have an ESP32 and wrote a little program that reads a temperature sensor (dallas) every 30 seconds, and switches a relay attached to the same device, based on the temperature. This all works fine and all code for this is placed on the ESP so strictly speaking, HA is not needed for the operation. But i was thinking: The temperature value is now send to HA every 30 seconds, and i do not really need to see the temperature value change that often in the dashboard. As the automation is not running from HA, and i am not interested in seeing the value change every 30 seconds, updating the values that often is not needed.

Is it possible to have the ESP32 read the value every 30 seconds, and control the relay, but only update HA of the values every 10/15 minutes or so? Although the packets are small and the load is low, its a bit of load i do not need on the system, and might save on some write cycles in HA.

Thanks in advance!

I think you can use a sensor template. This takes the data from the dht sensor and you can define data manipulation, or in your case, a different update interval. I think you can also use copy integration

Hello Julian,

Thanks for the reply! I looked into the template sensor and its features but it was not entirely wat i was looking for.

I decided to settle on creating a filter, which then creates a dead band around measurements and in this way the ESP doesn’t report home that often.

- delta: 0.2
This makes the ESP only report back if there is a temperature change of more than .2 degree I might raise this number in the future if i find it still reports too often.

Here’s a filter I like to use for sensors.

        - or:
          - throttle: 5min
          - delta: 1

This allows setting the update interval low so the sensor responds realtime but it does not flood home assistant and the graphs stay updated without large gaps if the sensor does not change enough to reach the delta.

update_interval: 10s