diff --git a/components/modbus_controller.rst b/components/modbus_controller.rst index 82601c6f9a..6e32a63894 100644 --- a/components/modbus_controller.rst +++ b/components/modbus_controller.rst @@ -89,6 +89,9 @@ Configuration variables: - **lambda** (**Required**, :ref:`lambda `): Lambda that returns the value of this register. +Automations: + +- **on_command_sent** (*Optional*, :ref:`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 ` +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 --------