taligentx / dscKeybusInterface

An Arduino/esp8266/esp32 library to directly interface with DSC security systems.
GNU General Public License v3.0
497 stars 125 forks source link

Support for 95 users, decoded more status & keys messages, additions to 0x87, 0xC3 cmds #182

Closed kricon closed 3 years ago

kricon commented 3 years ago

As discussed in #175 I've decoded User code range 35-95 present on new panels. Placing Pull request instead of logs output, should be faster and easier for both :) Tested for: 1, 2, 3, 5, 6, 7, 9, Arm/disarm, random access codes in range 1-75. Just for reference, Zone expander 7 supervisory and 5/*6 access by users 41-42 already decoded in previous pull request which is already merged.

Changes: Seperated printPanelStatus1X as it conflicted between 0x14, 0x17 and 0x1B. Added printPanelStatus5 (for arm/disarm/9 user codes 35-95 except 40-42) Added printPanelStatus18 (5 and 6 users 1-95, 7/Auto-arm cancel users 35-95) Added accessCodeIncrease boolean onto printPanelAccessCode, making support for user codes 33-39 and consecutive decoding for users 33-95 by increment of 3 starting with user40, for printPanelData5,17,18 used on 0xEB and 0xEC cmds.

EDIT: in commit b20d79a I've included two new decoded messages, for entering 6-code installer code and 6-code user codes. EDIT2: in commit 92d0a00 more messages are decoded, for key ouput. Global label broadcast and Data received confirmation as seen in #184 logs EDIT3: in commit 06cbfc0 0x87 fully decoded as per #166 "Battery check in progress" message decoded aswell. EDIT4: in commit b4961fa 0xC3 cmd bits3&4 decoded - it is used for dialing attemps and dialer attempt end. EDIT5: in commit 00f2a51 PGM2 input supervisory trouble/restore for printPanelStatus0 is decoded. EDIT6: in commit e256c2d added decoding for Event buffer 75% full as well as few new keypad function keys added. EDIT7: Decoded few new status/panel messages. More info on 0x8D cmd. Added new messages to VirtualKeypad examples.

NOTE: printPanelAccessCode need to check panel version before making prefixes for user codes 33, 34, 41 and 42. Panels with version 4.1 and below have preset user codes 33,34 as Duress and 41,42 as Supervisory. On panels with version 4.2 and above, only user code 40 is preset as Master, other ones can be individualy set as duress/supervisory.

Also, processPanelStatus5 should be added in dscKeybusProcessData.cpp for following which user code (in range 35-95) armed/disarmed system in sketches.

KeybusReader sketch compiles and flashes fine for Arduino Uno (output from latest commit 8b4caeb):

Sketch uses 32256 bytes (100%) of program storage space. Maximum is 32256 bytes.
Global variables use 961 bytes (46%) of dynamic memory, leaving 1087 bytes for local variables. Maximum is 2048 bytes.
taligentx commented 3 years ago

Merged, thank you for this work! Splitting out printPanelStatus1X makes sense, and I'll see if there's code elsewhere that can be consolidated. With this merge, I'm seeing the Arduino Uno code size at 31118 bytes so there's a little bit of breathing room.

kricon commented 3 years ago

Can you verify ranges 75-95 and which is the last user code PC1864 accepts? On PC1616 - 48 and on PC1832 - 75 (instead of 72 as per manual). I found out more Key messages so it's nice there is room to include it. As for 0x8D/0x6E and similar cmds, do you plan including it at all? I've checked 0x8D byte3 and succesfuly decoded 0x01 until 0xDE with just few gaps inbetween. It wont fit on Arduino for sure.

taligentx commented 3 years ago

Can you verify ranges 75-95 and which is the last user code PC1864 accepts?

Looks good! User 95 is the last user, anything after that results in an error beep (aside from 99 to configure the user attributes):

11101011 0 00000010 00010110 00011010 00010011 00010100 00000101 01011111 00000000 10101000 [0xEB] 2016.06.16 19:05 | Partition 2 | Disarmed: User code 75
11101011 0 00000010 00010110 00011010 00010010 11101000 00010111 01101111 00000000 10011101 [0xEB] 2016.06.16 18:58 | Partition 2 | *1: User code 75
11101011 0 00000010 00010110 00011010 00010010 11101000 00011000 10000001 00000000 10110000 [0xEB] 2016.06.16 18:58 | Partition 2 | *5: User code 75
11101011 0 00000010 00010110 00011010 00010011 00010000 00000101 00111001 00000000 01111110 [0xEB] 2016.06.16 19:04 | Partition 2 | Armed: User code 95
11101011 0 00000010 00010110 00011010 00010010 11010000 00010111 10000011 00000000 10011001 [0xEB] 2016.06.16 18:52 | Partition 2 | *1: User code 95
11101011 0 00000010 00010110 00011010 00010010 11011000 00011000 10010101 00000000 10110100 [0xEB] 2016.06.16 18:54 | Partition 2 | *5: User code 95

.

As for 0x8D/0x6E and similar cmds, do you plan including it at all?

Sure, the Keybus decoding code in dscKeybusPrintData.cpp can keep growing (though I'll need to start excluding some decoding from the Uno, etc) - it's the core interface code in dscKeybusInterface.cpp and status processing code in dscKeybusProcessData.cpp that I'd like to focused on only processing data that has practical applications.

For example, I'll need to split off handling the 0x0F, 0xE6.21, 0xE6.01, and 0xE6.02 status messages you noted that are constantly sent in installer programming from partitions 2-4 - in the current code, a copy of each of these messages would need to be stored in memory for redundantPanelData() to eliminate the flood of messages in KeybusReader. However, this memory increase would affect all sketches, so I'll be taking a look on reworking this to be more flexible.