Limit number of times sensor is published to HA

Hi!
I think this question is extendable to another sensors outside ESPHome.
It’s possible to limite the number of times a sensor is recorded in ‘recorder’ from Home Assistant?
I know that I can change update_interval in esphome sensor…but, for one sensor specific, TVOC sensor, the recomended update rate for better measurement is 1 second (I can see a warning during compile time if I change to anything that is not 1 second)…but 1 second generates a lot of data in my recorder. Actually more than 500k in 5~7 days (that’s the history time that I need).
So, in HA or ESPHome, is possible to keep sensor update interval to a lower value but recorder with a different value?

A workaround might be to exclude the sensor from the recorder to avoid the data flood.
Then make an input variable and update that with a script that runs at the interval you want to store data at.

Found a solution!
Set original sensor as internal (so it will not send data to HA) and create a template sensor returning the internal sensor, but with update_interval of 60s
Example:

- platform: template
      name: "${device_full_name} - eCO2"
      id: eco2_ha
      icon: mdi:chemical-weapon
      device_class: carbon_dioxide
      state_class: "measurement"
      accuracy_decimals: 0
      lambda: |-
        return (id(eco2).state); # eco2 is the id of internal sensor
      update_interval: 60s
2 Likes

You can also use the delta filter which will only send updates when there is a change in state.

But this is a problem…state is changing a lot! and it’s used internally for another calculations…just in HA that I don’t need all these values.
But creating a dummy sensor and setting original one as internal solved my problem.
Tks!