[modbus_controller] on command sent trigger (#4039)

Co-authored-by: Leo Schelvis <leo.schelvis@gmail.com>
This commit is contained in:
leejoow 2024-07-22 03:33:14 +02:00 committed by GitHub
parent 662447151b
commit cfca1bcb52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -89,6 +89,9 @@ Configuration variables:
- **lambda** (**Required**, :ref:`lambda <config-lambda>`):
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
--------------
@ -721,6 +724,28 @@ The response is mapped to the sensor based on ``register_count`` and offset in b
.. _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
--------