-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkonnected_interface_kit_control.yaml
250 lines (250 loc) · 10.2 KB
/
konnected_interface_kit_control.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
blueprint:
name: Konnected Interface Kit Control
description: Synchronises an alarm control panel entity with a Konnected Interface Kit using a key switch and a programable output which determines if the physical alarm is set.
domain: automation
input:
alarm_control_panel:
name: Alarm Control Panel
description: This is the alarm control panel entity to synchronise with the Konnected Interface Kit.
selector:
entity:
filter:
- domain:
- alarm_control_panel
multiple: false
konnected_alarm_set:
name: Konnected Alarm Set
description: This is the programable output which determines if the physical alarm is set.
selector:
entity:
filter:
- domain:
- binary_sensor
multiple: false
konnected_alarm_triggered:
name: Konnected Alarm Triggered
description: This is the programable output which determines if the physical alarm is triggered. This can be connected to the siren output.
selector:
entity:
filter:
- domain:
- binary_sensor
multiple: false
arm_alarm_control_panel_action:
name: Arm Control Panel Alarm Action
description: This is the action used to arm the alarm control panel entity to armed away mode. This works best if the exit delay is skipped.
selector:
action: {}
disarm_alarm_control_panel_action:
name: Disarm Control Panel Alarm Action
description: This is the action used to disarm the alarm control panel entity.
selector:
action: {}
arm_konnected_alarm_action:
name: Arm Konnected Alarm Action
description:
This is the action used to arm the physical alarm to armed away
mode.
selector:
action: {}
disarm_konnected_alarm_action:
name: Disarm Konnected Alarm Action
description: This is the action used to disarm the physical alarm.
selector:
action: {}
entry_delay:
name: Entry Delay
description: The entry delay of the physical alarm. The entry delay of the alarm control panel entity should be set to be 10 seconds longer than this.
default: 0
selector:
number:
min: 0.0
max: 180.0
mode: slider
step: 10.0
unit_of_measurement: sec
exit_delay:
name: Exit Delay
description: The exit delay set of the physical alarm. The exit delay of the alarm control panel entity should be set to be 10 seconds longer than this.
default: 0
selector:
number:
min: 0.0
max: 180.0
mode: slider
step: 10.0
unit_of_measurement: sec
source_url: https://github.com/Excentyl/ha-blueprints/blob/main/konnected_interface_kit_control.yaml
variables:
alarm_control_panel_var: !input alarm_control_panel
entry_delay_var: !input entry_delay
exit_delay_var: !input exit_delay
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id:
- !input alarm_control_panel
id: alarm_control_panel_changes
- platform: state
entity_id:
- !input konnected_alarm_set
id: konnected_alarm_set_changes
- platform: state
entity_id:
- !input konnected_alarm_triggered
id: konnected_alarm_triggered_changes
condition:
- condition: template
value_template:
"{{ trigger.to_state.context.parent_id != trigger.from_state.context.id
}}"
action:
- if:
- condition: state
entity_id: !input alarm_control_panel
state: pending
then:
- delay:
hours: 0
minutes: 0
seconds:
"{{ max(entry_delay_var + 5 - (as_timestamp(now()) - as_timestamp(states[alarm_control_panel_var].last_updated)),
0) }}"
milliseconds: 0
- if:
- condition: state
entity_id: !input konnected_alarm_triggered
state: "off"
then: !input disarm_alarm_control_panel_action
else:
- choose:
- conditions:
- condition: trigger
id: alarm_control_panel_changes
sequence:
- choose:
- conditions:
- condition: state
entity_id: !input alarm_control_panel
state: disarmed
sequence:
- if:
- condition: or
conditions:
- condition: state
entity_id: !input konnected_alarm_set
state: "on"
- condition: template
value_template:
"{{ trigger.from_state.state == 'arming' and trigger.from_state.attributes.arm_mode
== 'armed_away' }}"
- condition: template
value_template:
"{{ (trigger.from_state.state == 'triggered' or
(trigger.from_state.state == 'pending' and (as_timestamp(trigger.to_state.last_updated)
- as_timestamp(trigger.from_state.last_updated)) < entry_delay_var
+ 5)) and trigger.from_state.attributes.arm_mode == 'armed_away'}}"
then: !input disarm_konnected_alarm_action
- conditions:
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: !input alarm_control_panel
state: arming
- condition: state
entity_id: !input alarm_control_panel
attribute: arm_mode
state: armed_away
- condition: and
conditions:
- condition: state
entity_id: !input alarm_control_panel
state: armed_away
- condition: template
value_template:
"{{ not(trigger.from_state.state == 'arming' and
trigger.from_state.attributes.arm_mode == 'armed_away') }}"
sequence:
- if:
- condition: state
entity_id: !input konnected_alarm_set
state: "off"
then: !input arm_konnected_alarm_action
- delay:
seconds: "{{ exit_delay_var + 10 }}"
- if:
- condition: state
entity_id: !input konnected_alarm_set
state: "off"
- condition: state
entity_id: !input alarm_control_panel
state: arming
- condition: state
entity_id: !input alarm_control_panel
attribute: arm_mode
state: armed_away
then: !input disarm_alarm_control_panel_action
- conditions:
- condition: trigger
id: konnected_alarm_set_changes
sequence:
- if:
- condition: state
entity_id: !input konnected_alarm_set
state: "on"
then:
- if:
- condition: not
conditions:
- condition: or
conditions:
- condition: state
entity_id: !input alarm_control_panel
state: armed_away
- condition: and
conditions:
- condition: state
entity_id: !input alarm_control_panel
state: arming
- condition: state
entity_id: !input alarm_control_panel
attribute: arm_mode
state: armed_away
then: !input arm_alarm_control_panel_action
else:
- if:
- condition: or
conditions:
- condition: state
entity_id: !input alarm_control_panel
state: armed_away
- condition: and
conditions:
- condition: state
entity_id: !input alarm_control_panel
state: arming
- condition: state
entity_id: !input alarm_control_panel
attribute: arm_mode
state: armed_away
then: !input disarm_alarm_control_panel_action
- conditions:
- condition: trigger
id: konnected_alarm_triggered_changes
sequence:
- if:
- condition: state
entity_id: !input konnected_alarm_triggered
state: "off"
- condition: or
conditions:
- condition: state
entity_id: !input alarm_control_panel
state: pending
- condition: state
entity_id: !input alarm_control_panel
state: triggered
then: !input disarm_alarm_control_panel_action