Trigger automation immediately but don't send every state update to Home Assistant

Hello.
I would like to set the update_interval of my sensor to 0ms because I need an automation that triggers immediately. The problem with that is that it will spam my Home Assistant with a constant stream of state updates. I don’t want that. Is it possible to update the state locally immediately but only send changes to Home Assistant at a specified interval?

Thanks.

There are sensor filters for this in esphome.
Fore example, the delta filter only sends a value if the difference is greater than the configured value.

filters:
  - delta: 5.0
1 Like

Thank you for pointing me to the filters. I must have missed the or filter option when I read the documentation. Combining throttle and delta was the option I was looking for.

    filters:
      - or:
        - throttle: 60s
        - delta: 0.2

In case you cannot get your desired result you can try setting the sensor to be internal, or give it an id and not a name, this will cause it to not be seen on HA and will allow you to use it normally from ESP.
Then create a templated sensor which pulls values from your internal sensor and apply filters there.

3 Likes

Oh that’s awesome! Thank you.