esphome-docs/components/binary_sensor/analog_threshold.rst

60 lines
2.4 KiB
ReStructuredText
Raw Normal View History

2022-02-17 21:14:14 +01:00
Analog Threshold Binary Sensor
==============================
.. seo::
:description: Instructions for setting up an analog threshold binary sensors.
:image: analog_threshold.svg
2022-04-03 09:30:25 +02:00
The ``analog_threshold`` binary sensor platform allows you to convert analog values
(i.e. :doc:`sensor </components/sensor/index>` readings)
into boolean values, using a threshold as a reference.
When the signal is above or equal to the threshold the binary sensor is ``true``
2022-05-15 13:54:47 +02:00
(this behavior can be changed by adding an ``invert`` filter).
2022-02-17 21:14:14 +01:00
It provides an *hysteresis* option to reduce instability when the source signal is noisy
2022-04-03 09:30:25 +02:00
using different limits depending on the current state.
Additionally a :ref:`delay filter <binary_sensor-filters>` could be used to only change
2022-02-17 21:14:14 +01:00
after a new state has been kept a minimum time.
If the source sensor is uninitialized at the moment of component creation, the initial
2022-04-03 09:30:25 +02:00
state of the binary sensor wil be ``false``, if later it has some reading errors, those
2022-02-17 21:14:14 +01:00
invalid source updates will be ignored, and the binary sensor will keep it´s last state.
For example, below configuration would turn the readings of current sensor into
a binary sensor.
.. code-block:: yaml
# Example configuration entry
binary_sensor:
- platform: analog_threshold
name: "Garage Door Opening"
sensor_id: motor_current_sensor
threshold: 0.5
Configuration variables
-----------------------
- **name** (**Required**, string): The name of the binary sensor.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- **sensor_id** (**Required**, :ref:`config-id`): The ID of the source sensor.
2022-04-03 09:30:25 +02:00
- **threshold** (**Required**, float or mapping): Configures the reference for comparison. Accepts either a shorthand
float number that will be used as both upper/lower threshold, or a mapping to define different values for each (to
2022-02-17 21:14:14 +01:00
use hysteresis).
- **upper** (**Required**, float): Upper threshold, that needs to be crossed to transition from ``low`` to ``high`` states.
- **lower** (**Required**, float): Lower threshold, that needs to be crossed to transition from ``high`` to ``low`` states.
- All other options from :ref:`Binary Sensor <config-binary_sensor>`.
See Also
--------
- :doc:`/components/binary_sensor/index`
- :doc:`/components/sensor/index`
- :ref:`automation`
- :apiref:`analog_threshold/analog_threshold_binary_sensor.h`
- :ghedit:`Edit`