Deconz: new REST endpoint for alarm system

I will try it tonight to see what happens doing a ha restart

Did a bunch of restarts but couldn’t trigger the exception.

Are you running Verisure integration by chance? Thats the only thing I can see that has a async_logout method which seems to be the cause of the issue here.

Nope, i don’t have that integration. I did set-up a new instance of HA and only added deconz. No automations or anything set up. I have a clean log without errors. I am puzzled but given this situation i would say the error is obviously on my side and you can safely consider no problems in the library/integration.

1 Like

Thanks for looking at this! I don’t like when there might be an issue :slight_smile:

Manup has posted a PR to provide the alarm system endpoint as expected by pydeconz. Can you build your own rest api plugin for deconz with this PR then you can try it all out

I’ve compiled it and it’s running ok - i can see the state in HA. I had no time to figure out how to sync the alarmsystems state in deconz to the one in HA which is important to have both systems in sync.
edit: deconz_alarm_event seems not to fire in HA. I armed the alarmsystem in deconz but no events were visible in HA.

It’s much simpler now than the first implementation.

The alarm control panel should reflect the alarm system state directly

The alarm event is only to expose 4 special events now. Emergency, fire, invalid code and panic

I should update the integration documentation

I armed it in HA but it did not reflect in deconz and vice versa. I understand this should work “be default” not, right?
Maybe some stuff about my system - i have a manual alarm system in HA which basically only has a keypad + code (same as deconz). I was using this with a geofence to turn the alarm on and off as i leave/enter the house.

You have set a code right? You need to define a code for the alarm system in deconz.

I’m not following completely you have a zigbee keypad paired with deconz right?

Next step would be to enable debug and share logs when you perform different actions with the alarm system

I have a physical keypad set up with deconz and a PIN. The alarm works as expected in deconz - i can arm and disarm it with the keypad, the alarm is triggered, etc. In HA i have a manual alarm set up also with a PIN (set up in the YAML file - the code is the same as in deconz).
My feeling was that the virtual keypad from HA would be in sync with deconz and this is what i have tested. I armed_away the HA alarm system but the deconz one stayed disarmed. I tried it the other way around - i armed the deconz alarmsystems/1. I could see the status in HA, on the deconz keypad entity, but this was not reflected in the HA alarm system.
I’ll debug a bit when i am back in front of a computer in the next few days.

the config

2021-08-30 08:48:13 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: {'alarmsystems': {'1': {'config': {'armed_away_entry_delay': 120,
                                   'armed_away_exit_delay': 120,
                                   'armed_away_trigger_duration': 120,
                                   'armed_night_entry_delay': 120,
                                   'armed_night_exit_delay': 120,
                                   'armed_night_trigger_duration': 120,
                                   'armed_stay_entry_delay': 120,
                                   'armed_stay_exit_delay': 120,
                                   'armed_stay_trigger_duration': 120,
                                   'armmode': 'disarmed',
                                   'configured': True,
                                   'disarmed_entry_delay': 0,
                                   'disarmed_exit_delay': 0},
                        'devices': {'00:0d:6f:00:0f:4f:19:6f-01-0501': {'armmask': 'AN'},
                                    '00:15:8d:00:03:4f:4e:43-01-0006': {'armmask': 'AN'},
                                    '00:15:8d:00:04:28:74:c9-01-0406': {'armmask': 'A'},
                                    '00:15:8d:00:04:62:e5:c6-01-0406': {'armmask': 'A'},
                                    '00:15:8d:00:04:63:04:e0-01-0406': {'armmask': 'A'},
                                    '00:15:8d:00:04:63:fc:f0-01-0406': {'armmask': 'A'},
                                    '00:15:8d:00:04:ab:dd:32-01-0006': {'armmask': 'AN'},
                                    '00:15:8d:00:05:3e:72:65-01-0006': {'armmask': 'AN'},
                                    '00:15:8d:00:05:3e:79:16-01-0006': {'armmask': 'AN'},
                                    '00:15:8d:00:05:3e:79:1f-01-0006': {'armmask': 'AN'}},
                        'name': 'Alarm System',
                        'state': {'armstate': 'disarmed',
                                  'seconds_remaining': 0}}},

relevant part of the log (its longer than allowed so pastebin…): 2021-08-30 09:00:30 DEBUG (MainThread) [pydeconz.websocket] {"e":"changed","id": - Pastebin.com

Thanks, I’ll have a look tonight

I didn’t see anything being sent out from hass to deconz in those logs, only events with state updates from deconz to hass. Most was just a timer counting down from 120s before changing state.

Did you really use the alarm panel from the keypad entity?

Yes, i entered the pin in HA gui and after some time HA was armed_away and deconz remainder disarmed. After some time i disarmed HA.

Your description sounds like it works as expected, at least in HA

Yes, it works as expected in HA but the armed state is not synched back to deconz and vice versa. According to what you’ve said above HA’s state should be in sync with deconz, meaning when i arm HA it should also arm deconz.

Its probably a front end issue in deconz then since the signalling seems to be working.

Report an issue on the Phoscon GitHub deCONZ forum Phoscon

i am looking at the rest API using postman. the alarmsystem/1 remains disarmed although in HA it’s armed_away. I have also the physical alarm keypad in HA visible as an entity - the status of it never changes. we can have a private chat on this if it helps - i am more than willing to help out.

Could you create a new log that includes when you send commands from the keypad in ha and annotate the log for clarification of what happens in ha and deconz?

I don’t personally see a need for this discussion to be held in a private chat.

According to your logs the state for both sensor and alarmsystem in deconz update to armed_away as expected

2021-08-30 09:02:33 DEBUG (MainThread) [pydeconz.websocket] {“e”:“changed”,“id”:“1”,“r”:“alarmsystems”,“state”:{“armstate”:“armed_away”,“seconds_remaining”:0},“t”:“event”}
2021-08-30 09:02:33 DEBUG (MainThread) [pydeconz.gateway] Unsupported resource {‘e’: ‘changed’, ‘id’: ‘1’, ‘r’: ‘alarmsystems’, ‘state’: {‘armstate’: ‘armed_away’, ‘seconds_remaining’: 0}, ‘t’: ‘event’}
2021-08-30 09:02:33 DEBUG (MainThread) [pydeconz.websocket] {“e”:“changed”,“id”:“37”,“r”:“sensors”,“state”:{“action”:“armed_away”,“lastupdated”:“2021-08-30T06:00:31.812”,“lowbattery”:true,“panel”:“armed_away”,“seconds_remaining”:0,“tampered”:false},“t”:“event”,“uniqueid”:“00:0d:6f:00:0f:4f:19:6f-01-0501”}

Sorry to hop in, but what are the zigbee devices that you’re using for your alarm setup ? Thanks !