mirror of
https://github.com/esphome/esphome-docs.git
synced 2025-01-24 22:02:04 +01:00
Add publish Action for Nextion components (#4368)
* Add Nextion actions * satisfy linter * add link to lambda section instead of providing examples * Apply suggestions from code review Co-authored-by: Keith Burzinski <kbx81x@gmail.com> * wrap lines --------- Co-authored-by: Keith Burzinski <kbx81x@gmail.com>
This commit is contained in:
parent
5b1fc790e6
commit
79a438b8a5
@ -87,6 +87,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 <config-templatable>`): The boolean state to publish.
|
||||
- **publish_state** (**Optional**, bool, :ref:`templatable <config-templatable>`): Publish new state to Home Assistant.
|
||||
Default is true.
|
||||
- **send_to_nextion** (**Optional**, bool, :ref:`templatable <config-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
|
||||
|
@ -95,6 +95,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 <config-templatable>`): The float state to publish.
|
||||
- **publish_state** (**Optional**, bool, :ref:`templatable <config-templatable>`): Publish new state to Home Assistant.
|
||||
Default is true.
|
||||
- **send_to_nextion** (**Optional**, bool, :ref:`templatable <config-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
|
||||
|
@ -59,6 +59,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 <config-templatable>`): The boolean state to publish.
|
||||
- **publish_state** (**Optional**, bool, :ref:`templatable <config-templatable>`): Publish new state to Home Assistant.
|
||||
Default is true.
|
||||
- **send_to_nextion** (**Optional**, bool, :ref:`templatable <config-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
|
||||
|
@ -55,6 +55,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 <config-templatable>`): The string to publish.
|
||||
- **publish_state** (**Optional**, bool, :ref:`templatable <config-templatable>`): Publish new state to Home Assistant.
|
||||
Default is true.
|
||||
- **send_to_nextion** (**Optional**, bool, :ref:`templatable <config-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
|
||||
|
Loading…
Reference in New Issue
Block a user