forked from Dilbert66/esphome-dsckeybus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DscAlarm.yaml
262 lines (241 loc) · 7.22 KB
/
DscAlarm.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
261
#for documentation see project at https://github.com/Dilbert66/esphome-dsckeybus
substitutions:
systemName: "dscalarm"
accessCode: !secret access_code #Only comes into effect if a password prompt occurs when arming eg. night mode
cmdWaitTime: "0" # milliseconds. set how long to delay before accepting a new 05 cmd as valid to filter out intermittent short duration bogus commands that some panels send. default = 0
esphome:
name: $systemName
platform: ESP8266
board: nodemcuv2
includes:
- dscKeybusInterface/
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "$systemName"
password: !secret wifi_password
logger:
baud_rate: 0
level: info
api:
password: !secret api_password
ota:
password: !secret ota_password
safe_mode: True
status_led:
pin:
number: D4
inverted: yes
custom_component:
- lambda: |-
auto DSCkeybus = new DSCkeybushome();
DSCkeybus->accessCode="$accessCode";
DSCkeybus->cmdWaitTime=$cmdWaitTime;
DSCkeybus->debug=2; // 0 = off, 1 = status change data, 2 = + 05/27 packets, 3 = + all packets received
DSCkeybus->onSystemStatusChange([&](std::string statusCode) {
id(system_status).publish_state(statusCode);
});
DSCkeybus->onPartitionStatusChange([&](uint8_t partition,std::string statusCode) {
switch(partition) {
case 1: id(p1).publish_state(statusCode); break;
case 2: id(p2).publish_state(statusCode); break;
}
});
DSCkeybus->onPartitionMsgChange([&](uint8_t partition,std::string msg) {
switch(partition) {
case 1: id(m1).publish_state(msg); break;
case 2: id(m2).publish_state(msg); break;
}
});
DSCkeybus->onTroubleStatusChange([&](troubleStatus ts,bool open) {
switch(ts) {
case trStatus: id(tr).publish_state(open);break;
case batStatus: id(bat).publish_state(open);break;
case acStatus: id(ac).publish_state(open);break;
case panicStatus: id(panic).publish_state(open);break;
default: break;
}
});
DSCkeybus->onFireStatusChange([&](uint8_t partition, bool open) {
switch (partition) {
case 1: id(f1).publish_state(open); break;
}
});
DSCkeybus->onZoneStatusChange([&](uint8_t zone, bool open) {
switch (zone) {
case 1: id(z1).publish_state(open); break;
case 2: id(z2).publish_state(open); break;
case 3: id(z3).publish_state(open); break;
case 4: id(z4).publish_state(open); break;
case 5: id(z5).publish_state(open); break;
case 6: id(z6).publish_state(open); break;
case 7: id(z7).publish_state(open); break;
case 8: id(z8).publish_state(open); break;
case 9: id(z9).publish_state(open); break;
case 10: id(z10).publish_state(open); break;
case 11: id(z11).publish_state(open); break;
}
});
DSCkeybus->onZoneAlarmChange([&](uint8_t zone, bool open) {
switch (zone) {
case 1: id(za1).publish_state(open); break;
case 2: id(za2).publish_state(open); break;
case 3: id(za3).publish_state(open); break;
case 4: id(za4).publish_state(open); break;
case 5: id(za5).publish_state(open); break;
case 6: id(za6).publish_state(open); break;
case 7: id(za7).publish_state(open); break;
case 8: id(za8).publish_state(open); break;
case 9: id(za9).publish_state(open); break;
case 10: id(za10).publish_state(open); break;
case 11: id(za11).publish_state(open); break;
}
});
return {DSCkeybus};
binary_sensor:
#zone status
- platform: template
id: z1
name: "$systemName Front door"
device_class: door
- platform: template
id: z2
name: "$systemName Garage door"
device_class: door
- platform: template
id: z3
name: "$systemName Back door"
device_class: door
- platform: template
id: z4
name: "$systemName Living room window"
device_class: window
- platform: template
id: z5
name: "$systemName Dining room window"
device_class: window
- platform: template
id: z6
name: "$systemName Family room window LF"
device_class: window
- platform: template
id: z7
name: "$systemName Family room window RF"
device_class: window
- platform: template
id: z8
name: "$systemName Basement windows"
device_class: window
- platform: template
id: z9
name: "$systemName Upstairs motion"
device_class: motion
- platform: template
id: z10
name: "$systemName Basement motion"
device_class: motion
- platform: template
id: z11
name: "$systemName Main floor motion"
device_class: motion
#zone alarm status
- platform: template
id: za1
name: "$systemName Front door alarm"
#device_class: safety
- platform: template
id: za2
name: "$systemName Garage door alarm"
#device_class: safety
- platform: template
id: za3
name: "$systemName Back door alarm"
#device_class: safety
- platform: template
id: za4
name: "$systemName Living room window alarm"
#device_class: safety
- platform: template
id: za5
name: "$systemName Dining room window alarm"
#device_class: safety
- platform: template
id: za6
name: "$systemName Family room window LF alarm"
#device_class: safety
- platform: template
id: za7
name: "$systemName Family room window RF alarm"
#device_class: safety
- platform: template
id: za8
name: "$systemName Basement windows alarm"
#device_class: safety
- platform: template
id: za9
name: "$systemName Upstairs motion alarm"
#device_class: safety
- platform: template
id: za10
name: "$systemName Basement motion alarm"
#device_class: safety
- platform: template
id: za11
name: "$systemName Main floor motion alarm"
#device_class: safety
- platform: template
id: tr
name: "$systemName Trouble Status"
device_class: problem
- platform: template
id: bat
name: "$systemName Battery Status"
device_class: problem
- platform: template
id: ac
name: "$systemName AC Status"
device_class: plug
- platform: template
id: panic
name: "$systemName Panic Status"
device_class: safety
- platform: template
id: f1
device_class: safety
name: "$systemName Fire Status"
text_sensor:
- platform: template
id: system_status
name: "$systemName System Status"
icon: "mdi:shield"
- platform: template
id: p1
name: "$systemName Partition 1 Status "
icon: "mdi:shield"
- platform: template
id: p2
name: "$systemName Partition 2 Status "
icon: "mdi:shield"
- platform: template
id: m1
name: "$systemName Partition 1 Msg "
icon: "mdi:alert-box"
- platform: template
id: m2
name: "$systemName Partition 2 Msg "
icon: "mdi:alert-box"
switch:
- platform: template
name: "$systemName Connection"
id: connection_status_switch
lambda: |-
return dsc.keybusConnected;
icon: "mdi:shield-link-variant"
turn_on_action:
- switch.toggle: restart_switch
turn_off_action:
- lambda: |-
disconnectKeybus();
- platform: restart
id: restart_switch