mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 07:17:14 +00:00
correct note about trigger (#12372)
* correct note about trigger Don't think the existing way of testing automations with trigger in templates makes sense. I tried to show how to debug such automations. * add missing bracket to fix the build
This commit is contained in:
parent
6d786ef26e
commit
08817e566f
@ -76,7 +76,15 @@ Knowing how to access the [state object](/docs/configuration/state_object/) of a
|
|||||||
|
|
||||||
<div class='note'>
|
<div class='note'>
|
||||||
|
|
||||||
Be aware that if you reference a trigger state object in an automation action, attempting to test that automation by calling the `automation.trigger` service or by clicking EXECUTE in the More Info box for the automation will not work. This is because the trigger state object doesn't exist in those contexts. One way to test automations like these is to manually change the state of the trigger entity at Developer Tools > States.
|
Be aware that if you reference a `trigger` state object in templates of automation `action`, attempting to test that automation by calling the `automation.trigger` service or by clicking EXECUTE in the More Info box for the automation will not work. This is because the trigger state object doesn't exist in those contexts. One way to test automations like these is to manually check that the templates work as expected by pasting them in Developer Tools > Template together with your trigger's definition like:
|
||||||
|
|
||||||
|
{%raw%}
|
||||||
|
```yaml
|
||||||
|
{% set trigger={'to_state':{'state': 'heat'}} %}
|
||||||
|
{% set option = trigger.to_state.state %}
|
||||||
|
{{ 'on' if option == 'heat' else 'off' }}
|
||||||
|
```
|
||||||
|
{%endraw%}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user