Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question #294

Open
george1616 opened this issue Jun 14, 2022 · 3 comments
Open

question #294

george1616 opened this issue Jun 14, 2022 · 3 comments

Comments

@george1616
Copy link

george1616 commented Jun 14, 2022

Hi,you could add the arming of the system with user code 01, 02 ......... 40 and disarming as well? And I would have another request if it is possible to transmit the tamper detection , periodic test is very useful. thank you and good luck, sorry for my bad English

@Alviunta
Copy link

Hi @george1616, if you want to track these events, I recommend that you investigate the protocol status notification system. Many of the states that you request are decoded in this library, I recommend that you look at the dscKeybusPrintData.cpp file, there you will find all the information you need. As a starting point, investigate the panel commands 0xA5, 0xCE, and 0xEB and the functions they connect to.
It is not a complicated task to do what you mention once you understand the basic operation.

@george1616
Copy link
Author

Hi Alviunta,sorry to bother you. I wanna implement ac loss for example in schetch status if u can help me to understand . The line wold be something like this . I know this is for battery status , but i dont know what to change to maked hapening // Checks panel battery status
if (dsc.batteryChanged) {
dsc.batteryChanged = false; // Resets the battery trouble status flag
if (dsc.batteryTrouble) Serial.println(F("Panel battery trouble"));
else Serial.println(F("Panel battery restored"));
}
thx for your time

@Alviunta
Copy link

Alviunta commented Jun 24, 2022

Hi @george1616, if you want to track the AC loss event, you can use dsc.powerchange and dsc.powertrouble just like you did in the example.
(I recommend that you look at the example files status.ino where you can find all the "variables" that the library tracks for you)

On the other hand, it may happen that some of the events that you want to track are not already tracked by the library, in that case you should do what I mentioned before. I leave you here an example of how to track the loss of AC:

...
if (dsc.loop()) // Returns true if valid panel data is available
{
switch (dsc.panelData[0])
        {
        // PANEL STATUS
        case 0xA5:
            // Partition: dsc.panelData[3] >> 6
            // Status set selector: byte 5 bits 0-1 (dsc.panelData[5] & 0x03)
            //  Status set 0 1 2 3
            //  Status byte 6 (dsc.panelData[6])
            setSelector = dsc.panelData[5] & 0x03;
            switch (setSelector)
            {
            case 0x00:
                switch (dsc.panelData[statusByte])
                {
                case 0xE8: // Panel AC power trouble
                     SOME CODE
                     break;
               case 0xF0: // Panel AC power restored
                     SOME CODE
                     break;
...

Short explanation: dsc.panelData[] is an array containing the bytes read directly from the keybus. With the information decoded (it is available to you in the file dscKeybusPrintData.cpp) and using the status messages, which are headed with 0xA0, 0xCE and/or 0xEB (hence the switch dsc.panelData[0]:) you can get panel status information. I strongly recommend you look at the file I mentioned, the information is extremely complete and there are very few unknown events.

If you want you can combine both ways to obtain the panel status.
If you want to understand a little more about how dsc.panelData[] is used you can look at the unlocker.ino example.
As a recommendation, only use dsc.panelData[] if you need to, since you'll have to spend some time understanding how it works and how to accomplish what you need to do.

I hope you find it useful. Sorry but I don't speak English well either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants