Skip to content

Commit 42612c1

Browse files
authored
Merge pull request home-assistant#4516 from home-assistant/skalavala-patch-1
added code to escape jinja2 template code
2 parents adf508a + 7f22cf1 commit 42612c1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

source/_docs/scripts.markdown

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ wait_template: "{{ is_state(dummy, 'off') }}"
116116

117117
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.
118118

119+
{% raw %}
119120
```yaml
120121
event: LOGBOOK_ENTRY
121122
event_data:
@@ -124,12 +125,14 @@ event_data:
124125
entity_id: device_tracker.paulus
125126
domain: light
126127
```
128+
{% endraw %}
127129

128130
### {% linkable_title Raise and Consume Custom Events %}
129131

130132
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.
131133

132-
```
134+
{% raw %}
135+
```yaml
133136
- alias: Fire Event
134137
trigger:
135138
platform: state
@@ -140,10 +143,11 @@ The following automation shows how to raise a custom event called `event_light_t
140143
event_data:
141144
entity_id: "{{ trigger.entity_id }}"
142145
```
146+
{% endraw %}
143147

144148
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.
145149

146-
```
150+
```yaml
147151
- alias: Capture Event
148152
trigger:
149153
platform: event

0 commit comments

Comments
 (0)