esphome / esphome/feature-requests

Immediate update of throttled_average if large delta detected

Open
#2,415 17 comments 3 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem you have/What new integration you would like**

Getting smoothed and throttled readings on a sensor while still allowing instant updates for large changes.

**Please describe your use case for this integration and alternatives you've tried:**

I don't currently see a way to smooth and throttle values from a sensor, while still allowing instant updates if a large delta happens.

I tried doing this with an 'or' filter containing a delta and throttle_average:
```
or:
- delta: 20.0
- throttle_average: 5s
```
But the result is the below graph, where the sensor seems to flip between the delta and the average whenever a large change happens, or at least this is what seems to be happening.
![Screenshot_20231002_095258_Samsung Notes~3.png](https://github.com/esphome/feature-requests/assets/1903507/49c933a4-076c-46fb-b41e-37ad6b4c286f)

If there isn't another way of doing this already, perhaps having a `delta_override` option on the `throttle_average` filter would work? Where whenever the input value is over that delta, it clears the average history for the current window and immediately sends an update with the input value, then goes back to averaging.

**Additional context**
I flashed an Emporia Vue 2 energy monitor with ESPHome and the custom component available for that, and I'm trying to reduce the update frequency of power sensors overall while still having instant updates when meaningful deltas happen.

A percentage delta that has a minimum value would be lovely. I can implement that kind of delta with a lambda, but if it ends up being built into throttle_average then the flexibility would be lost. The importance of this is because a 5% difference on 15 watts isn't meaningful, and 5 watts difference on 2500 watts also isn't meaningful (enough to warrant an instant update anyway), so having a minimum on that percentage delta is important.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the sensor configuration using the `delta` and `throttle_average` filters, including the reported flipping behavior during large changes. Compare the requested immediate-update behavior with the existing filter semantics; done means smoothed and throttled readings remain stable while a configurable large delta produces one immediate update and resumes averaging.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.