-
Notifications
You must be signed in to change notification settings - Fork 49
/
blackout.yaml
184 lines (156 loc) · 5.78 KB
/
blackout.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
blackout:
homeassistant:
customize:
binary_sensor.blackout:
friendly_name: Blackout
template:
- binary_sensor:
# Сенсор определения отключения электрики
- name: blackout
state: >
{{ states('sensor.server_telemetry') | float > 800
and is_state('binary_sensor.electricity', 'on')
}}
delay_on:
minutes: 1
delay_off:
minutes: 2
device_class: problem
automation:
- alias: control_host_shotdown
id: control_host_shotdown
description: Действия при отключении электрики
initial_state: true
trigger:
# Сработка сенсора блекаута
- platform: state
entity_id: binary_sensor.blackout
from: 'off'
to: 'on'
condition:
# Переключатель режима работы сервера
- condition: state
entity_id: switch.control_mode
state: 'on'
action:
- service: light.turn_off
entity_id:
- light.dd_wled_light
- light.dd_table_lamp
- alias: control_host_after_shotdown_local
id: control_host_after_shotdown_local
description: Запуск после блекаута - локальный
initial_state: true
trigger:
# Сработка сенсора блекаута
- platform: state
entity_id: binary_sensor.blackout
from: 'on'
to: 'off'
action:
# Шлюз кухня
- service: homeassistant.reload_config_entry
data: {}
target:
device_id: 4063f2da86f527b793ff4d1e9790782e
- delay: 00:00:05
# Шлюз ДА
- service: homeassistant.reload_config_entry
data: {}
target:
device_id: 686dc0bff60c982563531ee37679ed21
- delay: 00:00:05
# Шлюз LR
- service: homeassistant.reload_config_entry
data: {}
target:
device_id: 5519c03a52f44692503cbf20df607876
# - delay: 00:00:05
# # Стерилизация
# - service: homeassistant.reload_config_entry
# data: {}
# target:
# device_id: 85a7f09979b3725edce34363bc99f220
- alias: control_after_shotdown
id: control_after_shotdown
description: Запуск после блекаута
initial_state: true
trigger:
# Сработка сенсора блекаута
- platform: state
entity_id: binary_sensor.blackout
from: 'on'
to: 'off'
condition:
# Переключатель режима работы сервера
- condition: state
entity_id: switch.control_mode
state: 'on'
action:
# Выключатель DD лента
- service: switch.turn_off
entity_id: switch.0x00158d0001a2ccab_right
- delay: 00:00:05
- service: switch.turn_on
entity_id: switch.0x00158d0001a2ccab_right
- delay: 00:00:05
# Выключатель прихожая
- service: switch.turn_off
entity_id: switch.0x00158d00057305ac_right
- delay: 00:00:05
- service: switch.turn_on
entity_id: switch.0x00158d00057305ac_right
- delay: 00:00:05
# Выключатель коридор
- service: switch.turn_off
entity_id: switch.0x00158d00057305ac_left
- delay: 00:00:05
- service: switch.turn_on
entity_id: switch.0x00158d00057305ac_left
- delay: 00:00:05
# Выключатель ванная
- service: switch.turn_off
entity_id: switch.0x00158d0001117040_right
- delay: 00:00:05
- service: switch.turn_on
entity_id: switch.0x00158d0001117040_right
- delay: 00:00:05
# Выключатель гостиная
- service: switch.turn_off
entity_id: switch.0x00158d00062fbb54_right
- delay: 00:00:05
- service: switch.turn_on
entity_id: switch.0x00158d00062fbb54_right
- delay: 00:00:05
# Выключатель туалет
- service: switch.turn_off
entity_id: switch.0x00158d00014dceb3_left
- delay: 00:00:05
- service: switch.turn_on
entity_id: switch.0x00158d00014dceb3_left
- delay: 00:00:05
# ИК база
- 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
- delay: 00:00:30
# Выключение света
- service: light.turn_off
entity_id:
- light.kn_ceiling_light
- light.cr_ceiling_light
- light.tt_ceiling_light
- light.lr_ceiling_light_1
- light.bt_ceiling_light
- light.dd_ceiling_light
- light.smart_cw_light
- light.24key_rbg_strip
- light.da_projector
# Контрольная проверка для выключателей туалета и гостиной
- delay: 00:02:00
- service: switch.turn_on
entity_id: switch.0x00158d00062fbb54_right
- service: switch.turn_on
entity_id: switch.0x00158d00014dceb3_left