mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-17 22:36:51 +00:00
2022.4: Variables on trigger
This commit is contained in:
parent
b5ecf0b5e5
commit
11b9225db7
@ -391,11 +391,13 @@ For the latest information about all available selectors and their options,
|
|||||||
|
|
||||||
## Variables on trigger
|
## Variables on trigger
|
||||||
|
|
||||||
TODO:
|
For the more advanced uses cases, this release provides: variables on trigger.
|
||||||
- Needs content
|
It is exactly what it says on the can: The possibility of setting variables
|
||||||
|
on triggers that become available when that specific trigger triggers.
|
||||||
|
|
||||||
We now support setting variables on trigger, that become available when that
|
These variables can be helpful to pass down specific information based on the
|
||||||
trigger triggers.
|
trigger that fired. The automation example below shows how a message can be
|
||||||
|
passed to the notify service based on its triggering motion sensor.
|
||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
|
|
||||||
@ -403,9 +405,15 @@ trigger triggers.
|
|||||||
automation:
|
automation:
|
||||||
trigger:
|
trigger:
|
||||||
- platform: state
|
- platform: state
|
||||||
entity_id: binary_sensor.motion
|
entity_id: binary_sensor.motion_garage
|
||||||
|
to: "on"
|
||||||
variables:
|
variables:
|
||||||
trigger_message: "Motion sensor got triggered!"
|
trigger_message: "Motion detected in the garage! 🚘"
|
||||||
|
- platform: state
|
||||||
|
entity_id: binary_sensor.motion_garden
|
||||||
|
to: "on"
|
||||||
|
variables:
|
||||||
|
trigger_message: "Motion detected in the garden! 🌷"
|
||||||
action:
|
action:
|
||||||
- service: notify.iphone
|
- service: notify.iphone
|
||||||
data:
|
data:
|
||||||
@ -414,7 +422,7 @@ automation:
|
|||||||
|
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
[Updated selectors documentation](/docs/automation/trigger/#trigger-variables)
|
Oh! And yes: these variables can use templates too!
|
||||||
|
|
||||||
## Other noteworthy changes
|
## Other noteworthy changes
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user