You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This action allows you to fire an event. Events can be used for many things. It could trigger an automation or indicate to another component that something is happening. For instance, in the below example it is used to create an entry in the logbook.
118
118
119
+
{% raw %}
119
120
```yaml
120
121
event: LOGBOOK_ENTRY
121
122
event_data:
@@ -124,12 +125,14 @@ event_data:
124
125
entity_id: device_tracker.paulus
125
126
domain: light
126
127
```
128
+
{% endraw %}
127
129
128
130
### {% linkable_title Raise and Consume Custom Events %}
129
131
130
132
The following automation shows how to raise a custom event called `event_light_turned_on` with `entity_id` as the event data. The action part could be inside a script or an automation.
131
133
132
-
```
134
+
{% raw %}
135
+
```yaml
133
136
- alias: Fire Event
134
137
trigger:
135
138
platform: state
@@ -140,10 +143,11 @@ The following automation shows how to raise a custom event called `event_light_t
140
143
event_data:
141
144
entity_id: "{{ trigger.entity_id }}"
142
145
```
146
+
{% endraw %}
143
147
144
148
The following automation shows how to capture the custom event `event_light_turned_on`, and retrieve corresponsing `entity_id` that was passed as the event data.
0 commit comments