mirror of
https://github.com/esphome/esphome-docs.git
synced 2025-02-21 02:32:06 +01:00
[modbus_controller] on command sent trigger (#4039)
Co-authored-by: Leo Schelvis <leo.schelvis@gmail.com>
This commit is contained in:
parent
662447151b
commit
cfca1bcb52
@ -89,6 +89,9 @@ Configuration variables:
|
|||||||
- **lambda** (**Required**, :ref:`lambda <config-lambda>`):
|
- **lambda** (**Required**, :ref:`lambda <config-lambda>`):
|
||||||
Lambda that returns the value of this register.
|
Lambda that returns the value of this register.
|
||||||
|
|
||||||
|
Automations:
|
||||||
|
|
||||||
|
- **on_command_sent** (*Optional*, :ref:`Automation <automation>`): An automation to perform when a modbus command has been sent. See :ref:`modbus_controller-on_command_sent`
|
||||||
|
|
||||||
Example Client
|
Example Client
|
||||||
--------------
|
--------------
|
||||||
@ -721,6 +724,28 @@ The response is mapped to the sensor based on ``register_count`` and offset in b
|
|||||||
|
|
||||||
.. _modbusseealso:
|
.. _modbusseealso:
|
||||||
|
|
||||||
|
.. _modbus_controller-automations:
|
||||||
|
|
||||||
|
Automation
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. _modbus_controller-on_command_sent:
|
||||||
|
|
||||||
|
``on_command_sent``
|
||||||
|
*******************
|
||||||
|
|
||||||
|
This automation will be triggered when a command has been sent by the `modbus_controller`. In :ref:`Lambdas <config-lambda>`
|
||||||
|
you can get the function code in ``function_code`` and the register address in ``address``.
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
modbus_controller:
|
||||||
|
- id: modbus_con
|
||||||
|
# ...
|
||||||
|
on_command_sent:
|
||||||
|
then:
|
||||||
|
- number.increment: modbus_commands
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user