Add rotary_encoder.set_value action (#358)

Fixes https://github.com/esphome/feature-requests/issues/389
This commit is contained in:
Otto Winter 2019-10-19 21:45:01 +02:00
parent ec78f828fb
commit c1d053e071
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
1 changed files with 32 additions and 0 deletions

View File

@ -61,6 +61,38 @@ Configuration variables:
the knob further will not increase the number. Defaults to no maximum.
- All other options from :ref:`Sensor <config-sensor>`.
``sensor.rotary_encoder.set_value`` Action
------------------------------------------
The internal state of the rotary encoder can be manually changed to any value with this action.
After executing this action, rotating the encoder further will increase/decrease the state relative
to the newly set internal value.
.. code-block:: yaml
# Example configuration entry
sensor:
- platform: rotary_encoder
id: my_rotary_encoder
# ...
# in some trigger
on_...:
- sensor.rotary_encoder.set_value:
id: my_rotary_encoder
value: 10
# Templated
- sensor.my_rotary_encoder.publish:
id: my_rotary_encoder
value: !lambda 'return -1;'
Configuration options:
- **id** (**Required**, :ref:`config-id`): The ID of the rotary encoder.
- **value** (**Required**, int, :ref:`templatable <config-templatable>`):
The value to set the internal counter to.
See Also
--------