Skip to content

Commit b6dd4f1

Browse files
pkejvalswoboda1337
andauthored
Improve Heartbeat filter (#5451)
* optimistic mode * fix space * Fix line length * Add examples * Clean up example --------- Co-authored-by: Jonathan Swoboda <[email protected]>
1 parent 89f4d7c commit b6dd4f1

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

content/components/sensor/filter/heartbeat.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,29 @@ description: ""
33
headless: true
44
---
55

6-
Send the value periodically with the specified time interval.
7-
If the sensor value changes during the interval the interval will not reset.
8-
The last value of the sensor will be sent.
6+
Send the sensor value periodically at the specified time interval. If the sensor value changes
7+
during this interval, the timer will not reset — the last known value of the sensor will still
8+
be sent when the interval elapses.
99

10-
So a value of `10s` will cause the filter to output values every 10s regardless
11-
of the input values.
10+
For example, a value of `10s` will cause the filter to output the last known value every 10 seconds,
11+
regardless of how often the input value changes.
12+
13+
When using `optimistic` mode, the filter will still repeat the last known value at the configured interval,
14+
but in addition, every new incoming value is published immediately as it arrives. This ensures that the
15+
sensor output updates instantly on change, while maintaining a steady periodic "heartbeat" of the last value
16+
between updates. This mode is useful for sensors where immediate responsiveness is desired.
17+
18+
Configuration variables:
19+
20+
- **period** (Required, time): The interval at which the last known value is republished.
21+
- **optimistic** (*Optional*, boolean): When enabled, every new incoming value is published immediately as it
22+
arrives, regardless of the configured time interval.
23+
24+
```yaml
25+
# Example filters
26+
filters:
27+
- heartbeat: 5s
28+
- heartbeat:
29+
period: 5s
30+
optimistic: true
31+
```

0 commit comments

Comments
 (0)