CircuitSetup / Expandable-6-Channel-ESP32-Energy-Meter

Hardware & Software documentation for the CircuitSetup Expandable 6 Channel ESP32 Energy Meter. Works with ESPHome and Home Assistant.
https://circuitsetup.us/product/expandable-6-channel-esp32-energy-meter/
MIT License
510 stars 102 forks source link

Feature Request: Add throttle_average #131

Open hanley-development opened 1 year ago

hanley-development commented 1 year ago

Instead of having a continuous stream and so that there aren't 5000 points of data per day can throttle average be added to the sensor?

Another workaround would be to create a way to optionally only send through template rather than sensor directly. throttle_average could be applied to template sensor.

throttle_average An average over the specified time period, potentially throttling incoming values. When this filter gets incoming values, it sums up all values and pushes out the average after the specified time period passed. There are two edge cases to consider within the specified time period:

no value(s) received: NaN is returned - add the heartbeat filter if periodical pushes are required and/or filter_out: nan if required

one value received: the value is pushed out after the specified time period passed, without calculating an average

For example a throttle_average: 60s will push out a value every 60 seconds, in case at least one sensor value is received within these 60 seconds.

# Take a measurement every 10s but only report the average 
# every 300s. This is to overcome the noisy ADC on the ESP32.
   update_interval: 10s
   filters:
     - throttle_average: 300s