From 1479b2dc76aaaf57d52986007006436aa362959c Mon Sep 17 00:00:00 2001 From: blissarts <54777977+blissarts@users.noreply.github.com> Date: Fri, 9 Oct 2020 15:13:08 +0200 Subject: [PATCH] Add an example for the Threshold binary sensor (#15073) Co-authored-by: Franck Nijhof --- source/_integrations/threshold.markdown | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/source/_integrations/threshold.markdown b/source/_integrations/threshold.markdown index 1f15ad925af..4157085a22e 100644 --- a/source/_integrations/threshold.markdown +++ b/source/_integrations/threshold.markdown @@ -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 +```