/
lr_reboot.yaml
260 lines (233 loc) · 9.71 KB
/
lr_reboot.yaml
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
255
256
257
258
259
260
lr_reboot:
template:
- binary_sensor:
# Несанкционированное включение zigbee ленты
- name: lr_tvled_enabled
unique_id: lr_tvled_enabled
state: >
{{ is_state('light.0xa4c138b72a314e97', 'on')
and is_state('light.lr_light_cinema', 'off') }}
delay_on: '00:00:05'
# Сенсор определяющий недоступность люстры 1
- name: lr_ceiling_1_unavailable
unique_id: lr_ceiling_1_unavailable
state: >
{{ is_state('light.yeelight_ceiling4_0x49c726b', 'unavailable') }}
delay_on:
minutes: 5
device_class: problem
# Сенсор определяющий недоступность люстры 1
- name: lr_ceiling_2_unavailable
unique_id: lr_ceiling_2_unavailable
state: >
{{ is_state('light.yeelight_ceiling4_0x4a1dacd', 'unavailable') }}
delay_on:
minutes: 5
device_class: problem
# Сенсор определяющий недоступность IR контроллера Broadlink
- name: lr_broadlin_ir
unique_id: lr_broadlin_ir
state: >
{{ is_state('sensor.lr_broadlin_ir_temperature', 'unavailable') }}
delay_on:
minutes: 2
device_class: problem
# Сенсор определяющий залипание датчика электрики в гостиной
- name: lr_broadlin_ir
unique_id: lr_broadlin_ir
state: >
{{ is_state('sensor.lr_broadlin_ir_temperature', 'unavailable') }}
delay_on:
minutes: 2
device_class: problem
input_button:
lr_ceiling_1_reset:
name: LR ceiling 1 reboot
lr_ceiling_2_reset:
name: LR ceiling 2 reboot
automation:
#################### ПЕРЕЗАГРУЗКА ЛЮСТР ####################
- alias: lr_reboot_ceiling_1
id: lr_reboot_ceiling_1
description: Гостиная - перезагрузка зависшей люстры 1
initial_state: true
trigger:
# Проверка раз в 5 минут, перезагрузка если люстра недоступна
- platform: time_pattern
minutes: '/5'
condition:
# Переключатель режима работы сервера
- condition: state
entity_id: switch.control_mode
state: 'on'
# Сенсор определяющий недоступность люстры
- condition: state
entity_id: binary_sensor.lr_ceiling_1_unavailable
state: 'on'
# Сенсор электричества
- condition: state
entity_id: binary_sensor.electricity
state: 'off'
action:
# Перезагрузка по питанию
- service: switch.turn_off
entity_id: switch.0x00158d00062fbb54_right
- delay: 00:00:05
- service: switch.turn_on
entity_id: switch.0x00158d00062fbb54_right
- service: telegram_bot.send_message
data_template:
target:
- !secret chat_id_log
message: |
{{"\U0001F916"}} Антонио. Гостиная - перезагрузка люстры 1 {{ states('sensor.time_date') }}
- alias: lr_reboot_ceiling_1_manual
id: lr_reboot_ceiling_1_manual
description: Гостиная - ручная перезагрузка зависшей люстры 1
initial_state: true
trigger:
## Виртуальная кнопка
- platform: state
entity_id: input_button.lr_ceiling_1_reset
action:
# Перезагрузка по питанию
- service: switch.turn_off
entity_id: switch.0x00158d00062fbb54_right
- delay: 00:00:05
- service: switch.turn_on
entity_id: switch.0x00158d00062fbb54_right
- alias: lr_reboot_ceiling_2
id: lr_reboot_ceiling_2
description: Гостиная - перезагрузка зависшей люстры 2
initial_state: true
trigger:
# Проверка раз в 5 минут, перезагрузка если люстра недоступна
- platform: time_pattern
minutes: '/5'
condition:
# Переключатель режима работы сервера
- condition: state
entity_id: switch.control_mode
state: 'on'
# Сенсор определяющий недоступность люстры
- condition: state
entity_id: binary_sensor.lr_ceiling_2_unavailable
state: 'on'
# Сенсор электричества
- condition: state
entity_id: binary_sensor.electricity
state: 'off'
action:
# Перезагрузка по питанию
- service: switch.turn_off
entity_id: switch.0x842e14fffee5451a
- delay: 00:00:05
- service: switch.turn_on
entity_id: switch.0x842e14fffee5451a
- service: telegram_bot.send_message
data_template:
target:
- !secret chat_id_log
message: |
{{"\U0001F916"}} Антонио. Гостиная - перезагрузка люстры 2 {{ states('sensor.time_date') }}
- alias: lr_reboot_ceiling_2_manual
id: lr_reboot_ceiling_2_manual
description: Гостиная - ручная перезагрузка зависшей люстры 2
initial_state: true
trigger:
## Виртуальная кнопка
- platform: state
entity_id: input_button.lr_ceiling_2_reset
action:
# Перезагрузка по питанию
- service: switch.turn_off
entity_id: switch.0x842e14fffee5451a
- delay: 00:00:05
- service: switch.turn_on
entity_id: switch.0x842e14fffee5451a
#################### ЛЕНТА ЗА ТЕЛЕВИЗОРОМ ####################
- alias: lr_reboot_tvled_check
id: lr_reboot_tvled_check
description: Гостиная - проверка статуса zigbee LED ленты
initial_state: true
trigger:
# Проверка раз в 5 минут
- platform: time_pattern
minutes: '/5'
condition:
# Переключатель режима работы сервера
- condition: state
entity_id: switch.control_mode
state: 'on'
action:
# Принудительное обновление статуса
- service: mqtt.publish
data_template:
topic: "zigbee2mqtt_3/LR TV Strip/get"
payload_template: '{ "state": "" }'
- alias: lr_reboot_tvled_off
id: lr_reboot_tvled_off
description: Гостиная - отключение zigbee LED ленты
initial_state: true
trigger:
# Проверка раз в 3 минуты
- platform: time_pattern
minutes: '/3'
condition:
# Переключатель режима работы сервера
- condition: state
entity_id: switch.control_mode
state: 'on'
# Сенсор несанкционированное включение zigbee ленты
- condition: state
entity_id: binary_sensor.lr_tvled_enabled
state: 'on'
# Телевизор
- condition: state
entity_id: binary_sensor.lr_tv_work
state: 'off'
action:
- service: light.turn_off
entity_id:
- light.0xa4c138b72a314e97
- service: telegram_bot.send_message
data_template:
target:
- !secret chat_id_log
message: |
{{"\U0001F916"}} Антонио. Отключение ТВ подсветки {{ states('sensor.time_date') }}
#################### ПЕРЕЗАГРУЗКА IR BROADLINK ####################
- alias: lr_reboot_broadlink_ir
id: lr_reboot_broadlink_ir
description: Гостиная - перезагрузка ИК контроллера Broadlink
initial_state: true
trigger:
# Проверка раз в 5 минут
- platform: time_pattern
minutes: '/5'
condition:
# Переключатель режима работы сервера
- condition: state
entity_id: switch.control_mode
state: 'on'
# Сенсор определяющий недоступность ИК контроллера
- condition: state
entity_id: binary_sensor.lr_broadlin_ir
state: 'on'
# Сенсор электричества
- condition: state
entity_id: binary_sensor.electricity
state: 'off'
action:
# Перезагрузка по питанию
- service: switch.turn_off
entity_id: switch.smart_power_strip_44eu_w_socket_5
- delay: 00:00:05
- service: switch.turn_on
entity_id: switch.smart_power_strip_44eu_w_socket_5
- service: telegram_bot.send_message
data_template:
target:
- !secret chat_id_log
message: |
{{"\U0001F916"}} Антонио. Гостиная - перезагрузка ИК контроллера Broadlink {{ states('sensor.time_date') }}