From 12afecde0d86ce89a9c6072cdad0e554b073e5aa Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 19 Dec 2017 01:49:52 +0100 Subject: [PATCH] Update with range (#4242) --- .../binary_sensor.threshold.markdown | 39 ++++++++++++++----- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/source/_components/binary_sensor.threshold.markdown b/source/_components/binary_sensor.threshold.markdown index c2e9e875b39..aa12fad99f5 100644 --- a/source/_components/binary_sensor.threshold.markdown +++ b/source/_components/binary_sensor.threshold.markdown @@ -14,15 +14,17 @@ ha_release: 0.34 --- -The `threshold` binary sensor platform observes the state of another sensor. If the value is below (`lower`) or higher (`upper`) than the given threshold then state of the threshold sensor is changed. +The `threshold` binary sensor platform observes the state of another sensor. If the value is below (`lower`) or higher (`upper`) than the given threshold then state of the threshold sensor is changed. It support also a range if `lower` and `upper` are given. If the sensor is configured with no hysteresis and the sensor value is equal to the threshold, the sensor is turned off since it is not `lower` or `upper` with respect to the threshold. It's an alternative to the template binary sensor's `value_template:` to get the abnormal/too high/too low states. +{% raw %} ```yaml -{% raw %}{{ states.sensor.furnace.state > 2.5 }}{% endraw %} +{{ states.sensor.furnace.state > 2.5 }} ``` +{% endraw %} To enable the threshold sensor, add the following lines to your `configuration.yaml`: @@ -30,15 +32,32 @@ To enable the threshold sensor, add the following lines to your `configuration.y # Example configuration.yaml entry binary_sensor: - platform: threshold - threshold: 15 - type: lower entity_id: sensor.random + lower: 20 ``` -Configuration variables: +{% configuration %} +entity_id: + description: "The entity to monitor. Only [sensors](/components/sensor/) are supported." + required: true + type: entity_id +lower: + description: The lower threshold which the observed value is compared against. + required: false + type: float +upper: + description: The upper threshold which the observed value is compared against. + required: false + type: float +hysteresis: + description: The distance the observed value must be from the threshold before the state is changed. + required: false + type: float + default: 0.0 +name: + description: Name of the sensor to use in the frontend. + required: false + type: string + default: +{% endconfiguration %} -- **entity_id** (*Required*): The entity to monitor. Only [sensors](/components/sensor/) are supported. -- **threshold** (*Required*): The threshold which the observed value is compared against. -- **type** (*Required*): `lower` if the value needs to be below the threshold or `upper` if higher. -- **hysteresis** (*Optional*): The distance the observed value must be from the threshold before the state is changed. Defaults to `0.0` -- **name** (*Optional*): Name of the sensor to use in the frontend. Defaults to `Stats`.