-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconst.py
425 lines (362 loc) · 10.2 KB
/
const.py
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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
"""
Constants used across package
"""
from enum import Enum
from typing import NamedTuple
class Max(Enum):
"""Max number of elements on the panel"""
AREAS = 8
COUNTERS = 64
KEYPADS = 16
OUTPUTS = 208
SETTINGS = 20
TASKS = 32
THERMOSTATS = 16
USERS = 203
LIGHTS = 256
ZONES = 208
ZONE_TEMPS = 16
class ZoneType(Enum):
"""Types of Elk zones"""
DISABLED = 0
BURGLAR_ENTRY_EXIT_1 = 1
BURGLAR_ENTRY_EXIT_2 = 2
BURGLAR_PERIMETER_INSTANT = 3
BURGLAR_INTERIOR = 4
BURGLAR_INTERIOR_FOLLOWER = 5
BURGLAR_INTERIOR_NIGHT = 6
BURGLAR_INTERIOR_NIGHT_DELAY = 7
BURGLAR24_HOUR = 8
BURGLAR_BOX_TAMPER = 9
FIRE_ALARM = 10
FIRE_VERIFIED = 11
FIRE_SUPERVISORY = 12
AUX_ALARM_1 = 13
AUX_ALARM_2 = 14
KEYFOB = 15
NON_ALARM = 16
CARBON_MONOXIDE = 17
EMERGENCY_ALARM = 18
FREEZE_ALARM = 19
GAS_ALARM = 20
HEAT_ALARM = 21
MEDICAL_ALARM = 22
POLICE_ALARM = 23
POLICE_NO_INDICATION = 24
WATER_ALARM = 25
KEY_MOMENTARY_ARM_DISARM = 26
KEY_MOMENTARY_ARM_AWAY = 27
KEY_MOMENTARY_ARM_STAY = 28
KEY_MOMENTARY_DISARM = 29
KEY_ON_OFF = 30
MUTE_AUDIBLES = 31
POWER_SUPERVISORY = 32
TEMPERATURE = 33
ANALOG_ZONE = 34
PHONE_KEY = 35
INTERCOM_KEY = 36
class ZonePhysicalStatus(Enum):
"""Zone physical status."""
UNCONFIGURED = 0
OPEN = 1
EOL = 2
SHORT = 3
class ZoneLogicalStatus(Enum):
"""Zone logical status."""
NORMAL = 0
TROUBLED = 1
VIOLATED = 2
BYPASSED = 3
class ArmedStatus(Enum):
"""Area arming status: armed status"""
DISARMED = "0"
ARMED_AWAY = "1"
ARMED_STAY = "2"
ARMED_STAY_INSTANT = "3"
ARMED_TO_NIGHT = "4"
ARMED_TO_NIGHT_INSTANT = "5"
ARMED_TO_VACATION = "6"
class ArmUpState(Enum):
"""Area arming status: Ability to arm"""
NOT_READY_TO_ARM = "0"
READY_TO_ARM = "1"
CAN_BE_FORCE_ARMED = "2"
ARMED_AND_EXIT_TIMER_RUNNING = "3"
FULLY_ARMED = "4"
FORCE_ARMED = "5"
ARMED_WITH_BYPASS = "6"
class AlarmState(Enum):
"""Area arming status: Current alarm state"""
NO_ALARM_ACTIVE = "0"
ENTRANCE_DELAY_ACTIVE = "1"
ALARM_ABORT_DELAY_ACTIVE = "2"
FIRE_ALARM = "3"
MEDICAL_ALARM = "4"
POLICE_ALARM = "5"
BURGLAR_ALARM = "6"
AUX_1_ALARM = "7"
AUX_2_ALARM = "8"
AUX_3_ALARM = "9"
AUX_4_ALARM = ":"
CARBON_MONOXIDE_ALARM = ";"
EMERGENCY_ALARM = "<"
FREEZE_ALARM = "="
GAS_ALARM = ">"
HEAT_ALARM = "?"
WATER_ALARM = "@"
FIRE_SUPERVISORY = "A"
VERIFY_FIRE = "B"
UNSUPERVISED_ZONE_TROUBLE = "U"
class ArmLevel(Enum):
"""Levels for Arm/Disarm al_encode messages"""
DISARM = "0"
ARMED_AWAY = "1"
ARMED_STAY = "2"
ARMED_STAY_INSTANT = "3"
ARMED_NIGHT = "4"
ARMED_NIGHT_INSTANT = "5"
ARMED_VACATION = "6"
ARM_TO_NEXT_AWAY_MODE = "7"
ARM_TO_NEXT_STAY_MODE = "8"
FORCE_ARM_TO_AWAY_MODE = "9"
FORCE_ARM_TO_STAY_MODE = ":"
class ZoneAlarmState(Enum):
"""Alarm state for a zone"""
NO_ALARM = "0"
BURGLAR_ENTRY_EXIT_1 = "1"
BURGLAR_ENTRY_EXIT_2 = "2"
BURGLAR_PERIMETER_INSTANT = "3"
BURGLAR_INTERIOR = "4"
BURGLAR_INTERIOR_FOLLOWER = "5"
BURGLAR_INTERIOR_NIGHT = "6"
BURGLAR_INTERIOR_NIGHT_DELAY = "7"
BURGLAR_24_HOUR = "8"
BURGLAR_BOX_TAMPER = "9"
FIRE_ALARM = ":"
FIRE_VERIFIED = ";"
FIRE_SUPERVISORY = "<"
AUX_ALARM_1 = "="
AUX_ALARM_2 = ">"
KEYFOB = "?" # not used
NON_ALARM = "@" # not used
CARBON_MONOXIDE = "A"
EMERGENCY_ALARM = "B"
FREEZE_ALARM = "C"
GAS_ALARM = "D"
HEAT_ALARM = "E"
MEDICAL_ALARM = "F"
POLICE_ALARM = "G"
POLICE_NO_INDICATION = "H"
WATER_ALARM = "I"
class KeypadKeys(Enum):
"""Keys on the keypad."""
NO_KEY = 0
USER_CODE_ENTERED = 0
STAR = 11
POUND = 12
F1 = 13
F2 = 14
F3 = 15
F4 = 16
STAY = 17
EXIT = 18
CHIME = 19
BYPASS = 20
ELK = 21
DOWN = 22
UP = 23
RIGHT = 24
LEFT = 25
F6 = 26
F5 = 27
DATA_KEY_MODE = 28
class FunctionKeys(Enum):
"""From KF: Which function key pressed"""
FORCE_KF_SYNC = "0"
F1 = "1"
F2 = "2"
F3 = "3"
F4 = "4"
F5 = "5"
F6 = "6"
STAR = "*"
CHIME = "C"
class ChimeMode(Enum):
"""Chime mode settings on an Area"""
OFF = 0
CHIME = 1
VOICE = 2
CHIMEANDVOICE = 3
class TextDescription(NamedTuple):
"""A text description."""
desc_type: int
number_descriptions: int
class TextDescriptions(Enum):
"""Types of description strings that can be retrieved from the panel"""
ZONE = TextDescription(0, Max.ZONES.value)
AREA = TextDescription(1, Max.AREAS.value)
USER = TextDescription(2, Max.USERS.value)
KEYPAD = TextDescription(3, Max.KEYPADS.value)
OUTPUT = TextDescription(4, 64)
TASK = TextDescription(5, Max.TASKS.value)
TELEPHONE = TextDescription(6, 0)
LIGHT = TextDescription(7, Max.LIGHTS.value)
ALARM_DURATION = TextDescription(8, 0)
SETTING = TextDescription(9, Max.SETTINGS.value)
COUNTER = TextDescription(10, Max.COUNTERS.value)
THERMOSTAT = TextDescription(11, Max.THERMOSTATS.value)
FUNCTION_KEY_1 = TextDescription(12, 0)
FUNCTION_KEY_2 = TextDescription(13, 0)
FUNCTION_KEY_3 = TextDescription(14, 0)
FUNCTION_KEY_4 = TextDescription(15, 0)
FUNCTION_KEY_5 = TextDescription(16, 0)
FUNCTION_KEY_6 = TextDescription(17, 0)
AUDIO_ZONE = TextDescription(18, 0)
AUDIO_SOURCE = TextDescription(19, 0)
# Map to convert message code to descriptive string
MESSAGE_MAP = {
"AM": "Alarm memory update",
"AP": "Send ASCII String",
"AR": "Alarm Reporting to Ethernet",
"AS": "Arming status report data",
"AT": "Ethernet Test to IP",
"AZ": "Alarm by zone reply",
"CA": "Reply Touchscreen audio command",
"CC": "Control output change update",
"CD": "Outgoing Audio Equip Command",
"CR": "Custom value report data",
"CS": "Control output status report data",
"CU": "Change user code reply",
"CV": "Counter Value Data",
"DK": "Display KP LCD Data, not used",
"DS": "Lighting Poll Response",
"EE": "Entry/Exit Time Data",
"EM": "Email Trigger to M1XEP",
"IC": "Send invalid user code digits",
"IE": "Installer program exited",
"IP": "M1XSP Insteon Program",
"IR": "M1XSP Insteon Read",
"KA": "Keypad areas report data",
"KC": "Keypad key change update",
"KF": "Function key pressed data",
"LD": "Log data with index",
"LW": "Reply temperature data",
"NS": "Reply Source Name",
"NZ": "Reply Zone Name",
"PC": "PLC change update",
"PS": "PLC status report data",
"RE": "Reset Ethernet Module",
"RP": "ELKRP connected",
"RR": "Real Time Clock Data",
"SD": "Text string description report data",
"SS": "System Trouble Status data",
"ST": "Temperature report data",
"T2": "Reply Omnistat 2 data",
"TC": "Task change update",
"TR": "Thermostat data report",
"UA": "User code areas report data",
"VN": "Reply Version Number of M1",
"XB": "reserved by ELKRP",
"XK": "Request Ethernet test",
"ZB": "Zone bypass report data",
"ZC": "Zone change update",
"ZD": "Zone definition report data",
"ZP": "Zone partition report data",
"ZS": "Zone status report data",
"ZV": "Zone analog voltage data",
"a0": "Disarm",
"a1": "Arm to away",
"a2": "Arm to stay",
"a3": "Arm to stay instant",
"a4": "Arm to night",
"a5": "Arm to night instant",
"a6": "Arm to vacation",
"a7": "Arm, step to next Away Mode",
"a8": "Arm, step to next Stay Mode",
"a9": "Force Arm to Away Mode",
"a:": "Force Arm to Stay Mode",
"ar": "Alarm Reporting Acknowledge",
"as": "Request arming status",
"at": "Ethernet Test Acknowledge",
"az": "Alarm by zone request",
"ca": "Request Touchscreen audio command",
"cd": "Incoming Audio Equip Command",
"cf": "Control output OFF",
"cn": "Control output ON",
"cp": "Request ALL custom values",
"cr": "Request custom value",
"cs": "Control output status request",
"ct": "Control output TOGGLE",
"cu": "Change user code request",
"cv": "Request Counter value",
"cw": "Write custom value data",
"cx": "Write counter value",
"dm": "Display message",
"ds": "Lighting Poll Request",
"ip": "M1XSP Insteon Program",
"ir": "M1XSP Insteon Read",
"ka": "Request keypad areas",
"kc": "Request F Key illumination status",
"kf": "Request simulated function key press",
"ld": "Request log data, with index",
"le": "Write Log Data Entry",
"lw": "Request temperature data",
"pc": "Control any PLC device",
"pf": "Turn OFF PLC device",
"pn": "Turn ON PLC device",
"ps": "Request PLC status",
"pt": "Toggle PLC device",
"rr": "Request Real Time Clock Read",
"rs": "Used by Touchscreen",
"rw": "Real Time Clock Write",
"sd": "Request text string descriptions",
"sp": "Speak phrase",
"ss": "Request System Trouble Status",
"st": "Request temperature",
"sw": "Speak word",
"t2": "Request Omnistat 2 data",
"tn": "Task activation",
"tr": "Request thermostat data",
"ts": "Set thermostat data",
"ua": "Request user code areas",
"vn": "request Version Number of M1",
"xk": "Reply from Ethernet test",
"zb": "Zone bypass request",
"zd": "Request zone definition data",
"zp": "Zone partition request",
"zs": "Zone status request",
"zv": "Request Zone analog voltage",
}
class ThermostatSetting(Enum):
"""Thermostat consts when setting"""
MODE = 0
HOLD = 1
FAN = 2
GET_TEMPERATURE = 3
COOL_SETPOINT = 4
HEAT_SETPOINT = 5
class ThermostatMode(Enum):
"""Thermostat modes"""
OFF = 0
HEAT = 1
COOL = 2
AUTO = 3
EMERGENCY_HEAT = 4
class ThermostatFan(Enum):
"""Thermostat fan"""
AUTO = 0
ON = 1
class ThermostatHold(Enum):
"""Thermostat hold"""
OFF = 0
ON = 1
class SettingFormat(Enum):
"""Types of values for settings."""
NUMBER = 0
TIMER = 1
TIME_OF_DAY = 2
class ElkRPStatus(Enum):
"""Elk remote programming status."""
DISCONNECTED = 0
CONNECTED = 1
INITIALIZING = 2