Skip to content

Commit 0c9d7af

Browse files
authored
Updated the templates
Added device class to the templates, and simplified them
1 parent 123542e commit 0c9d7af

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

source/_docs/z-wave/entities.markdown

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -135,20 +135,16 @@ The meaning of the `alarm_level` entity depends on the nature of the alarm senso
135135
- **254**: Deep sleep
136136
- **255**: Case open
137137

138-
If your device has an `access_control` entity, but not a `binary_sensor` equivalent, you can use a [template binary sensor](/components/binary_sensor.template/) to create one:
138+
If your device has an `access_control` entity, but not a `binary_sensor` equivalent, you can use a [template binary sensor](/components/binary_sensor.template/) to create one (here we've defined it as a door, but you can use [any relevant device class](/components/binary_sensor/#device-class):
139139

140140
```
141141
binary_sensor:
142142
- platform: template
143143
sensors:
144144
YOUR_SENSOR:
145145
friendly_name: "Friendly name here"
146-
value_template: >-
147-
{% raw %}{%- if is_state('sensor.YOUR_ORIGINAL_SENSOR_access_control', '22') -%}
148-
true
149-
{%- else -%}
150-
false
151-
{%- endif -%}{% endraw %}
146+
device_class: door
147+
value_template: {{ is_state('sensor.YOUR_ORIGINAL_SENSOR_access_control', '22') }}
152148
```
153149

154150
### {% linkable_title Burglar Entity %}
@@ -163,20 +159,16 @@ binary_sensor:
163159
- **254**: Deep sleep
164160
- **255**: Case open
165161

166-
If your device has a `burglar` entity, but not a `binary_sensor` equivalent, you can use a [template binary sensor](/components/binary_sensor.template/) to create one:
162+
If your device has a `burglar` entity, but not a `binary_sensor` equivalent, you can use a [template binary sensor](/components/binary_sensor.template/) to create one (here we've defined it as a motion sensor, but you can use [any relevant device class](/components/binary_sensor/#device-class:
167163

168164
```
169165
binary_sensor:
170166
- platform: template
171167
sensors:
172168
YOUR_SENSOR:
173169
friendly_name: "Friendly name here"
174-
value_template: >-
175-
{% raw %}{%- if is_state('sensor.YOUR_SENSOR_burglar', '8') -%}
176-
true
177-
{%- else -%}
178-
false
179-
{%- endif -%}{% endraw %}
170+
device_class: motion
171+
value_template: {{ is_state('sensor.YOUR_SENSOR_burglar', '8') }}
180172
```
181173

182174
### {% linkable_title Source Node ID Entity %}

0 commit comments

Comments
 (0)