esphome-docs/api/binary_sensor/index.rst

122 lines
2.5 KiB
ReStructuredText
Raw Normal View History

2018-05-13 11:37:02 +02:00
Binary Sensor
=============
.. cpp:namespace:: binary_sensor
In esphomelib, every component that exposes a binary state, is a :cpp:class:`BinarySensor`.
To create your own binary sensor, simply subclass :cpp:class:`BinarySensor` and call
:cpp:func:`BinarySensor::publish_state` to tell the frontend that you have a new state.
Inversion is automatically done for you when publishing state and can be changed by the
user with :cpp:func:`BinarySensor::set_inverted`.
Supported Binary Sensors
------------------------
.. toctree::
:glob:
2018-05-13 11:37:02 +02:00
*
2018-05-13 11:37:02 +02:00
Example Usage
-------------
.. code-block:: cpp
// Basic
App.register_binary_sensor(custom_binary_sensor);
// GPIO Binary Sensor
App.make_gpio_binary_sensor("Window Open", 36);
2018-05-14 21:15:49 +02:00
.. cpp:namespace:: nullptr
2018-05-13 11:37:02 +02:00
See :cpp:func:`Application::register_binary_sensor` and :cpp:func:`Application::make_gpio_binary_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
BinarySensor
************
.. doxygenclass:: binary_sensor::BinarySensor
:members:
:protected-members:
:undoc-members:
MQTTBinarySensorComponent
*************************
.. doxygenclass:: binary_sensor::MQTTBinarySensorComponent
:members:
:protected-members:
:undoc-members:
2018-11-10 15:29:50 +01:00
Filters
*******
.. doxygenclass:: binary_sensor::Filter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: binary_sensor::DelayedOnFilter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: binary_sensor::DelayedOffFilter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: binary_sensor::HeartbeatFilter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: binary_sensor::InvertFilter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: binary_sensor::LambdaFilter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: binary_sensor::UniqueFilter
:members:
:protected-members:
:undoc-members:
Triggers
********
.. doxygenclass:: binary_sensor::PressTrigger
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: binary_sensor::ReleaseTrigger
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: binary_sensor::ClickTrigger
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: binary_sensor::DoubleClickTrigger
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: binary_sensor::MultiClickTrigger
:members:
:protected-members:
:undoc-members: