mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 09:17:06 +00:00
Update scripts.markdown
This commit is contained in:
parent
94476935de
commit
3daa8c815d
@ -136,12 +136,12 @@ The following automation shows how to raise a custom event called `event_light_t
|
|||||||
- alias: Fire Event
|
- alias: Fire Event
|
||||||
trigger:
|
trigger:
|
||||||
platform: state
|
platform: state
|
||||||
entity_id: light.kitchen
|
entity_id: switch.kitchen
|
||||||
to: 'on'
|
to: 'on'
|
||||||
action:
|
action:
|
||||||
event: event_light_turned_on
|
event: event_light_state_changed
|
||||||
event_data:
|
event_data:
|
||||||
entity_id: "{{ trigger.entity_id }}"
|
state: "on"
|
||||||
```
|
```
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
@ -152,11 +152,11 @@ The following automation shows how to capture the custom event `event_light_turn
|
|||||||
- alias: Capture Event
|
- alias: Capture Event
|
||||||
trigger:
|
trigger:
|
||||||
platform: event
|
platform: event
|
||||||
event_type: light_turned_on
|
event_type: event_light_state_changed
|
||||||
action:
|
action:
|
||||||
- service: notify.notify
|
- service: notify.notify
|
||||||
data_template:
|
data_template:
|
||||||
message: "{{ trigger.event.data.entity_id }} is turned on."
|
message: "kitchen light is turned {{ trigger.event.data.state }}"
|
||||||
```
|
```
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user