The threshold integration observes the state of another sensor. If the value is below or higher than the given threshold then state of the threshold sensor is changed. It support also a range both the upper and lower limits 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 upper or lower with respect to the threshold.
Adding Threshold to your Home Assistant instance can be done via the user interface, by using this My button:
If the above My button doesn’t work, you can also perform the following steps manually:
Browse to your Home Assistant instance.
In the sidebar click on Settings.
From the configuration menu select: Devices & Services.
In top of the screen click the tab: Helpers.
In the bottom right, click on the Create helper button.
From the list, search and select “Threshold”.
Follow the instruction on screen to complete the set up.
Alternatively, this integration can be configured and set up manually via YAML
instead. To enable the Integration sensor in your installation, add the
following to your
# Example configuration.yaml entry binary_sensor: - platform: threshold entity_id: sensor.random lower: 20
The entity to monitor. Only sensors are supported.
Sets the class of the device, changing the device state and icon that is displayed on the frontend.
The distance the observed value must be from the threshold before the state is changed.
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 for this use-case:
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