2018-06-13 22:38:49 +02:00
|
|
|
Duty Cycle Sensor
|
|
|
|
=================
|
|
|
|
|
2018-11-14 22:12:27 +01:00
|
|
|
.. seo::
|
2019-02-16 23:25:23 +01:00
|
|
|
:description: Instructions for setting up duty cycle sensors in ESPHome
|
2021-11-16 03:19:33 +01:00
|
|
|
:image: percent.svg
|
2018-11-14 22:12:27 +01:00
|
|
|
|
2018-06-13 22:38:49 +02:00
|
|
|
The duty cycle sensor allows you to measure for what percentage of time a signal
|
|
|
|
on a GPIO pin is HIGH or LOW.
|
|
|
|
|
|
|
|
For example, you can measure if a status LED of a pool controller is permanently active
|
|
|
|
(indicating that the pump is on) or blinking.
|
|
|
|
|
|
|
|
.. figure:: images/duty_cycle-ui.png
|
|
|
|
:align: center
|
|
|
|
:width: 80.0%
|
|
|
|
|
2018-11-19 18:32:16 +01:00
|
|
|
.. code-block:: yaml
|
2018-06-13 22:38:49 +02:00
|
|
|
|
|
|
|
# Example configuration entry
|
|
|
|
sensor:
|
|
|
|
- platform: duty_cycle
|
|
|
|
pin: D0
|
|
|
|
name: Duty Cycle Sensor
|
|
|
|
|
|
|
|
Configuration variables:
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
- **pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The pin to observe for the duty
|
|
|
|
cycle.
|
2019-01-06 18:56:14 +01:00
|
|
|
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
|
|
|
|
|
2018-08-22 22:05:28 +02:00
|
|
|
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
|
2019-02-17 12:28:17 +01:00
|
|
|
- All other options from :ref:`Sensor <config-sensor>`.
|
2018-10-12 16:33:22 +02:00
|
|
|
|
2018-10-20 14:53:27 +02:00
|
|
|
See Also
|
|
|
|
--------
|
|
|
|
|
|
|
|
- :ref:`sensor-filters`
|
2019-05-12 22:44:59 +02:00
|
|
|
- :apiref:`duty_cycle/duty_cycle_sensor.h`
|
2019-02-07 13:54:45 +01:00
|
|
|
- :ghedit:`Edit`
|