Skip to content

Commit 4a7e3dc

Browse files
authored
[filters] Add throttle_with_priority (#5186)
1 parent 8b1c1fd commit 4a7e3dc

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

components/sensor/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ Filters are applied in the order they are defined in your configuration.
156156
send_every: 15
157157
- throttle: 1s
158158
- throttle_average: 1s
159+
- throttle_with_priority:
160+
timeout: 1s
161+
value:
162+
- 42.0
163+
- 43.0
159164
- heartbeat: 5s
160165
- debounce: 0.1s
161166
- timeout: 1min
@@ -209,6 +214,8 @@ Filters are applied in the order they are defined in your configuration.
209214

210215
.. include:: sensor-filter-throttle_average.rst
211216

217+
.. include:: sensor-filter-throttle_with_priority.rst
218+
212219
.. include:: sensor-filter-timeout.rst
213220

214221
.. include:: sensor-filter-to_ntc_resistance.rst
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
``throttle_with_priority``
2+
**************************
3+
4+
Throttle the incoming values unless they match a prioritized value. When this filter gets an incoming value, it first
5+
checks if it matches one of the prioritized values. If so, the value is passed through immediately. Otherwise, it
6+
checks if the last incoming value is at least ``specified time period`` old. If it is not older than the configured
7+
value, the value is not passed forward.
8+
9+
.. code-block:: yaml
10+
11+
# Example filters:
12+
filters:
13+
- throttle_with_priority:
14+
timeout: 1s
15+
value:
16+
- nan
17+
- 0

0 commit comments

Comments
 (0)