Add an example for the Threshold binary sensor (#15073)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
blissarts 2020-10-09 15:13:08 +02:00 committed by GitHub
parent d85f04847a
commit 1479b2dc76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,3 +60,24 @@ name:
type: string
default: Threshold
{% endconfiguration %}
## Examples
### Is the temperature rising or falling
The hysteresis parameter can be used in this use-case to avoid frequent state changes around the maximum or the minimum of a temperature curve. We also have to utilize the [derivative sensor](/integrations/derivative/) for this use-case:
```yaml
sensor:
- platform: derivative # will be positive for rising temperatures and negative for falling temperatures
source: sensor.temperature
unit_time: min
name: temperature derivative
time_window: 00:05:00
binary_sensor:
- platform: threshold # will switch state not at 0°C/min but 0.1°C/min or -0.1°C/min depending on the current state of the sensor, respectively
entity_id: sensor.temperature_derivative
upper: 0
hysteresis: 0.1 # sensor
name: temperature rising
```