diff --git a/components/binary_sensor/nextion.rst b/components/binary_sensor/nextion.rst index 9825c216f5..2a87dcb9eb 100644 --- a/components/binary_sensor/nextion.rst +++ b/components/binary_sensor/nextion.rst @@ -88,6 +88,50 @@ should be prefixed with the page name (page0/page1). ``nextion_component_name: page0.r0`` +.. _binary_sensor-nextion-publish_action: + +``binary_sensor.nextion.publish`` Action +---------------------------------------- + +You can also publish a state to a Nextion binary sensor from elsewhere in your YAML file +with the ``binary_sensor.nextion.publish`` action. + +.. code-block:: yaml + + # Example configuration entry + binary_sensor: + - platform: nextion + id: nextion_bsensor + ... + # in some trigger + on_...: + - binary_sensor.nextion.publish: + id: nextion_bsensor + state: true + # These are optional. Defaults to true. + publish_state: true + send_to_nextion: true + # Templated + - binary_sensor.nextion.publish: + id: nextion_bsensor + state: !lambda 'return true;' + # These are optional. Defaults to true. + publish_state: true + send_to_nextion: true + +Configuration variables: + +- **id** (**Required**, :ref:`config-id`): The ID of the Nextion switch. +- **state** (**Required**, string, :ref:`templatable `): The boolean state to publish. +- **publish_state** (**Optional**, bool, :ref:`templatable `): Publish new state to Home Assistant. + Default is true. +- **send_to_nextion** (**Optional**, bool, :ref:`templatable `): Publish new state to Nextion + display which will update component. Default is true. + +.. note:: + + This action can also be written in lambdas. See :ref:`nextion_binary_sensor_lambda_calls` + .. _nextion_binary_sensor_lambda_calls: Lambda Calls diff --git a/components/sensor/nextion.rst b/components/sensor/nextion.rst index b5d23af9ba..4ed3e231dd 100644 --- a/components/sensor/nextion.rst +++ b/components/sensor/nextion.rst @@ -96,6 +96,50 @@ should be prefixed with the page name (page0/page1 or whatever you have changed ``component_name: page0.humidity`` +.. _sensor-nextion-publish_action: + +``sensor.nextion.publish`` Action +--------------------------------- + +You can also publish a state to a Nextion sensor from elsewhere in your YAML file +with the ``sensor.nextion.publish`` action. + +.. code-block:: yaml + + # Example configuration entry + sensor: + - platform: nextion + id: nextion_sensor + ... + # in some trigger + on_...: + - sensor.nextion.publish: + id: nextion_sensor + state: 100.0 + # These are optional. Defaults to true. + publish_state: true + send_to_nextion: true + # Templated + - sensor.nextion.publish: + id: nextion_sensor + state: !lambda 'return 100.0;' + # These are optional. Defaults to true. + publish_state: true + send_to_nextion: true + +Configuration variables: + +- **id** (**Required**, :ref:`config-id`): The ID of the Nextion sensor. +- **state** (**Required**, string, :ref:`templatable `): The float state to publish. +- **publish_state** (**Optional**, bool, :ref:`templatable `): Publish new state to Home Assistant. + Default is true. +- **send_to_nextion** (**Optional**, bool, :ref:`templatable `): Publish new state to Nextion + display which will update component. Default is true. + +.. note:: + + This action can also be written in lambdas. See :ref:`nextion_sensor_lambda_calls` + .. _nextion_sensor_lambda_calls: Lambda Calls diff --git a/components/switch/nextion.rst b/components/switch/nextion.rst index b8055bd364..aefa8779b3 100644 --- a/components/switch/nextion.rst +++ b/components/switch/nextion.rst @@ -60,6 +60,50 @@ should be prefixed with the page name (page0/page1 or whatever you have changed ``component_name: page0.r0`` +.. _switch-nextion-publish_action: + +``switch.nextion.publish`` Action +--------------------------------- + +You can also publish a state to a Nextion switch from elsewhere in your YAML file +with the ``switch.nextion.publish`` action. + +.. code-block:: yaml + + # Example configuration entry + sensor: + - platform: nextion + id: nextion_switch + ... + # in some trigger + on_...: + - switch.nextion.publish: + id: nextion_switch + state: true + # These are optional. Defaults to true. + publish_state: true + send_to_nextion: true + # Templated + - switch.nextion.publish: + id: nextion_switch + state: !lambda 'return true;' + # These are optional. Defaults to true. + publish_state: true + send_to_nextion: true + +Configuration options: + +- **id** (**Required**, :ref:`config-id`): The ID of the Nextion switch. +- **state** (**Required**, string, :ref:`templatable `): The boolean state to publish. +- **publish_state** (**Optional**, bool, :ref:`templatable `): Publish new state to Home Assistant. + Default is true. +- **send_to_nextion** (**Optional**, bool, :ref:`templatable `): Publish new state to Nextion + display which will update component. Default is true. + +.. note:: + + This action can also be written in lambdas. See :ref:`nextion_switch_lambda_calls` + .. _nextion_switch_lambda_calls: Lambda Calls diff --git a/components/text_sensor/nextion.rst b/components/text_sensor/nextion.rst index 619ccb2e36..0d8605b756 100644 --- a/components/text_sensor/nextion.rst +++ b/components/text_sensor/nextion.rst @@ -56,6 +56,50 @@ should be prefixed with the page name (page0/page1 or whatever you have changed ``component_name: page0.text0`` +.. _text_sensor-nextion-publish_action: + +``text_sensor.nextion.publish`` Action +--------------------------------------- + +You can also publish a state to a Nextion text sensor from elsewhere in your YAML file +with the ``text_sensor.nextion.publish`` action. + +.. code-block:: yaml + + # Example configuration entry + text_sensor: + - platform: nextion + id: nextion_text + ... + # in some trigger + on_...: + - text_sensor.nextion.publish: + id: nextion_text + state: "Hello World" + # These are optional. Defaults to true. + publish_state: true + send_to_nextion: true + # Templated + - text_sensor.nextion.publish: + id: nextion_text + state: !lambda 'return "Hello World";' + # These are optional. Defaults to true. + publish_state: true + send_to_nextion: true + +Configuration variables: + +- **id** (**Required**, :ref:`config-id`): The ID of the Nextion text sensor. +- **state** (**Required**, string, :ref:`templatable `): The string to publish. +- **publish_state** (**Optional**, bool, :ref:`templatable `): Publish new state to Home Assistant. + Default is true. +- **send_to_nextion** (**Optional**, bool, :ref:`templatable `): Publish new state to Nextion + display which will update component. Default is true. + +.. note:: + + This action can also be written in lambdas. See :ref:`nextion_text_sensor_lambda_calls` + .. _nextion_text_sensor_lambda_calls: Lambda Calls