-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplates.yaml
More file actions
254 lines (240 loc) · 10.8 KB
/
templates.yaml
File metadata and controls
254 lines (240 loc) · 10.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
- sensor:
- name: "Light switches canonical data"
unique_id: light_switches_canonical_data
state: "ok"
attributes:
entities: >-
{{
states.switch
| rejectattr('attributes.entity_category', 'in', ['config','diagnostic'])
| rejectattr(
'entity_id',
'search',
'_detach_relay_mode|_power_on_state|_delayed|_delay|_indicator|_led|_network|_status|_restore|_startup|_mode|_child_lock|_open_window'
)
| rejectattr(
'entity_id',
'search',
'schedule|washing_machine|entrywaytablet'
)
| rejectattr(
'entity_id',
'search',
'_bell_'
)
| rejectattr('entity_id', 'equalto', 'switch.zigbee2mqtt_bridge_permit_join')
| rejectattr('entity_id', 'equalto', 'switch.bedroom_left_light')
| rejectattr('entity_id', 'equalto', 'switch.bedroom_right_light')
| rejectattr('entity_id', 'equalto', 'switch.washing_machine_power')
| rejectattr('entity_id', 'equalto', 'switch.washing_machine_child_lock')
| rejectattr('entity_id', 'equalto', 'switch.entrywaytablet_screen')
| rejectattr('entity_id', 'equalto', 'switch.entrywaytablet_screensaver')
| rejectattr('entity_id', 'equalto', 'switch.kitchen_cooker_power_switch')
| map(attribute='entity_id')
| list
}}
- name: "Light switches entities"
unique_id: light_switches_entities
state: "ok"
attributes:
entities: >-
{{ state_attr('sensor.light_switches_canonical_data', 'entities') | default([], true) }}
- name: "Light switches topology"
unique_id: light_switches_topology
state: "ok"
attributes:
entities: >-
{{ state_attr('sensor.light_switches_canonical_data', 'entities') | default([], true) }}
rows_json: >-
{%- set entities = state_attr('sensor.light_switches_canonical_data', 'entities') | default([], true) -%}
{%- set ns = namespace(items=[]) -%}
{%- for e in entities -%}
{%- set floor_label = floor_name(e) -%}
{%- set area_label = area_name(e) -%}
{%- if floor_label and area_label -%}
{%- set ns.items = ns.items + [{
'floor': floor_label,
'area': area_label,
'entity': e
}] -%}
{%- endif -%}
{%- endfor -%}
{%- set items = ns.items
| sort(attribute='entity')
| sort(attribute='area')
| sort(attribute='floor')
-%}
{%- set out = namespace(rows=[], prev_floor='', prev_area='') -%}
{%- for item in items -%}
{%- if item.floor != out.prev_floor -%}
{%- set out.rows = out.rows + [{'type': 'section', 'label': item.floor}] -%}
{%- set out.prev_floor = item.floor -%}
{%- set out.prev_area = '' -%}
{%- endif -%}
{%- if item.area != out.prev_area -%}
{%- set out.rows = out.rows + [{'type': 'section', 'label': '— ' ~ item.area}] -%}
{%- set out.prev_area = item.area -%}
{%- endif -%}
{%- set out.rows = out.rows + [{'entity': item.entity}] -%}
{%- endfor -%}
{{ out.rows | tojson }}
- name: "Alarms dashboard source"
unique_id: alarms_dashboard_source
state: "ok"
attributes:
unavailable_entities: >-
{%- set excluded_entities = [
'notify.entrywaytablet_overlay_message',
'notify.entrywaytablet_text_to_speech',
'number.entrywaytablet_screensaver_brightness',
'remote.fire_tv',
'select.washing_machine_active_program',
'sensor.washing_machine_program_finish_time',
'sensor.washing_machine_program_progress',
'select.washing_machine_spin_speed',
'select.washing_machine_temperature',
'select.washing_machine_selected_program'
] -%}
{%- set candidates = states
| rejectattr('entity_id','in', excluded_entities)
| rejectattr('entity_id','match','^select\..*_bell_play_quick_reply_message$')
| rejectattr('entity_id','match','^siren\..*_bell_siren$')
| rejectattr('entity_id','match','^person\.')
| rejectattr('entity_id','match','^zone\.')
| rejectattr('entity_id','match','^sun\.')
| rejectattr('entity_id','match','^weather\.')
| rejectattr('entity_id','match','^update\.')
| rejectattr('entity_id','match','^event\.')
| rejectattr('entity_id','match','^button\.')
| rejectattr('entity_id','match','^image\.')
| rejectattr('entity_id','match','^camera\.')
| rejectattr('entity_id','match','^persistent_notification\.')
| rejectattr('entity_id','match','^[^.]+\.kitchen_cooker_')
| rejectattr('entity_id','match','^[^.]+\.entrywaytablet')
| rejectattr('entity_id','match','^[^.]+\.galaxy_tab_4')
| rejectattr('entity_id','match','^[^.]+\.first_floor_tablet')
| rejectattr('entity_id','match','.*_power_on_behavior$')
| selectattr('state','in',['unavailable','unknown'])
| map(attribute='entity_id')
| list
-%}
{%- set visible = namespace(list=[]) -%}
{%- for e in candidates -%}
{%- if floor_name(e) and area_name(e) -%}
{%- set visible.list = visible.list + [e] -%}
{%- endif -%}
{%- endfor -%}
{{ visible.list }}
battery_low_entities: >-
{%- set battery_entities = states.sensor
| rejectattr('entity_id','match','^[^.]+\.kitchen_cooker_')
| rejectattr('entity_id','match','^[^.]+\.entrywaytablet')
| rejectattr('entity_id','match','^[^.]+\.galaxy_tab_4')
| rejectattr('entity_id','match','^[^.]+\.first_floor_tablet')
| selectattr('attributes.device_class','equalto','battery')
| map(attribute='entity_id')
| list
-%}
{%- set visible = namespace(list=[]) -%}
{%- for e in battery_entities -%}
{%- set v = states(e) -%}
{%- if v not in ['unknown','unavailable','none','None',''] -%}
{%- set n = v | float(default=999) -%}
{%- set unit = (state_attr(e,'unit_of_measurement') or '') | lower -%}
{%- if unit in ['%','percent'] and n < 10 and floor_name(e) and area_name(e) -%}
{%- set visible.list = visible.list + [e] -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{{ visible.list }}
doors_windows_entities: >-
{%- set candidates = states.binary_sensor
| rejectattr('entity_id','match','^[^.]+\.kitchen_cooker_')
| rejectattr('entity_id','match','^[^.]+\.entrywaytablet')
| rejectattr('entity_id','match','^[^.]+\.galaxy_tab_4')
| rejectattr('entity_id','match','^[^.]+\.first_floor_tablet')
| selectattr('attributes.device_class','in',['door','window'])
| selectattr('state','equalto','on')
| map(attribute='entity_id')
| list
-%}
{%- set visible = namespace(list=[]) -%}
{%- for e in candidates -%}
{%- if floor_name(e) and area_name(e) -%}
{%- set visible.list = visible.list + [e] -%}
{%- endif -%}
{%- endfor -%}
{{ visible.list }}
water_entities: >-
{%- set candidates = states.binary_sensor
| rejectattr('entity_id','match','^[^.]+\.kitchen_cooker_')
| rejectattr('entity_id','match','^[^.]+\.entrywaytablet')
| rejectattr('entity_id','match','^[^.]+\.galaxy_tab_4')
| rejectattr('entity_id','match','^[^.]+\.first_floor_tablet')
| selectattr('attributes.device_class','in',['moisture','water'])
| selectattr('state','equalto','on')
| map(attribute='entity_id')
| list
-%}
{%- set visible = namespace(list=[]) -%}
{%- for e in candidates -%}
{%- if floor_name(e) and area_name(e) -%}
{%- set visible.list = visible.list + [e] -%}
{%- endif -%}
{%- endfor -%}
{{ visible.list }}
smoke_entities: >-
{%- set candidates = states.binary_sensor
| rejectattr('entity_id','match','^[^.]+\.kitchen_cooker_')
| rejectattr('entity_id','match','^[^.]+\.entrywaytablet')
| rejectattr('entity_id','match','^[^.]+\.galaxy_tab_4')
| rejectattr('entity_id','match','^[^.]+\.first_floor_tablet')
| selectattr('attributes.device_class','equalto','smoke')
| selectattr('state','equalto','on')
| map(attribute='entity_id')
| list
-%}
{%- set visible = namespace(list=[]) -%}
{%- for e in candidates -%}
{%- if floor_name(e) and area_name(e) -%}
{%- set visible.list = visible.list + [e] -%}
{%- endif -%}
{%- endfor -%}
{{ visible.list }}
tamper_entities: >-
{%- set tamper_targets = [
'binary_sensor.terrace_door_open_sensor_tamper'
] -%}
{%- set candidates = states.binary_sensor
| rejectattr('entity_id','match','^[^.]+\.kitchen_cooker_')
| rejectattr('entity_id','match','^[^.]+\.entrywaytablet')
| rejectattr('entity_id','match','^[^.]+\.galaxy_tab_4')
| rejectattr('entity_id','match','^[^.]+\.first_floor_tablet')
| selectattr('entity_id','in', tamper_targets)
| selectattr('state','equalto','on')
| map(attribute='entity_id')
| list
-%}
{%- set visible = namespace(list=[]) -%}
{%- for e in candidates -%}
{%- if floor_name(e) and area_name(e) -%}
{%- set visible.list = visible.list + [e] -%}
{%- endif -%}
{%- endfor -%}
{{ visible.list }}
- name: "Tablet entryway config"
unique_id: tablet_entryway
state: "ok"
attributes:
tablet_id: "tablet_entryway"
notify_entity: "notify.mobile_app_entrywaytablet"
ip: "192.168.179.63"
password: "Dy683EjMcBrzkizy"
- name: "Tablet First Floor config"
unique_id: tablet_first_floor
state: "ok"
attributes:
tablet_id: "tablet_galaxy_tab_4"
notify_entity: "notify.galaxy_tab_4"
ip: "192.168.179.48"
password: "Dy683EjMcBrzkizy"