Deconz: new REST endpoint for alarm system

According to the documentation & latest beta release, deconz has introduced a new alarm system REST endpoint: Alarm Systems - deCONZ REST-API (dresden-elektronik.github.io)
This is a bit different from the previous pull request and implementation - the keypad REST endpoint appears to be read-only and from HA and the likes an armed_away or armed_night state can be set. Also the PIN is not passed any more in the REST call.
@Robban - is the current deconz integration in HA working with this?

Unfortunately it is not compliant. I want to update everything to work correctly with this but I don’t know if this can be added to a service release of home assistant or if it will need to wait for 2021.9 release.

Since its only used by those compiling deconz themselves we agreed to add it to the new beta and try to get everything fixed at the latest with next HA release.

i am willing to test :slight_smile: after all now i have a half working alarm system. what can i say… i had to scratch it…

1 Like

Awesome! This is my first week back from vacation, I hope I can muster energy to get this done shortly.

I’ve started implementing the changes. I should have something working before this weekend is over.

I’m not sure this can be brought in on a point release though, it’s nearly a breaking change

No worries, just release it in the next release cycle. Ping me when you’ve pushed it in dev and I’ll run a nightly docker instance to test it out.
Thanks a bunch!

I’ve got an implementation that covers all rest api examples ready Support alarm systems by Kane610 · Pull Request #138 · Kane610/deconz · GitHub

Waiting on some event examples.

Next step is to adapt hass alarm panel platform

PR for integration is up Update alarm control panel and deconz alarm event to reflect the finalized implementation in deCONZ by Kane610 · Pull

Still need to release a new version of the library

I am out for a few days but i’ll check it middle of next week. Thanks for your fast support on this!

1 Like

Merged! Beta on Wednesday so try it out!

Great, thanks. I’ll try the dev tomorrow, wednesday’s beta is too far away :joy:

Awesome! :heart:

i got the dev docker set-up but i can’t see the alarm keypad (physical device) not can i see the “alarmsystem” from deconz. maybe i miss something but just to be sure please give me a hint as to how this is supposed to work. I might have something missing in my setup…
Edit: i do have the deconz event for the alarm keypad but the entity for the pad itself is not there. and how do i see any events from the deconz “alarmsystems” in HA?
Edit 2: might be something

2021-08-24 12:30:33 INFO (MainThread) [pydeconz.websocket] Shutting down connection to deCONZ (192.168.0.11)
2021-08-24 12:30:33 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback EventBus.async_listen_once.<locals>._onetime_listener(<Event homeassistant_stop[L]>) at /usr/src/homeassistant/homeassistant/core.py:820
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/core.py", line 834, in _onetime_listener
    self._hass.async_run_job(listener, event)
  File "/usr/src/homeassistant/homeassistant/core.py", line 452, in async_run_job
    return self.async_run_hass_job(HassJob(target), *args)
  File "/usr/src/homeassistant/homeassistant/core.py", line 436, in async_run_hass_job
    return self.async_add_hass_job(hassjob, *args)
  File "/usr/src/homeassistant/homeassistant/core.py", line 363, in async_add_hass_job
    task = self.loop.create_task(hassjob.target(*args))
TypeError: async_logout() takes 1 positional argument but 2 were given

I forgot that the implementation depends on alarm system be a part of the request for all endpoints (which isn’t the case yet). I will ping deCONZ devs on that.

Can you enable debugging for deconz integration so I can see what message crashes everything?

I’ll try to catch the error and post the logs.
Regading the deConz devs - talk to manup, he’s working on the rules for the alarm system and he may be able to push an update so i can test it out and report back before the release

Yes that’s who I’m talking to. I usually prefer to not mention him to let him be anonymous :slight_smile:

How’s it going with the debug logs?

There should be a patch up to provide the endpoint for hass by the end of the week so you can then compile the rest plugin yoursemd

Great, thanks for the head’s up.

So it took a while to figure out the error only comes up when HA is being restarted. During normal operation mode no errors are coming up. Below you can see the last lines of the log up until the server restarts.

2021-08-25 15:27:28 DEBUG (MainThread) [pydeconz.websocket] {"attr":{"id":"31","lastannounced":null,"lastseen":"2021-08-25T12:27Z","manufacturername":"LUMI","modelid":"lumi.sensor_smoke","name":"Smoke Sensor","swversion":"20170314","type":"ZHAFire","uniqueid":"00:15:8d:00:04:1d:8f:5e-01-0500"},"e":"changed","id":"31","r":"sensors","t":"event","uniqueid":"00:15:8d:00:04:1d:8f:5e-01-0500"}
2021-08-25 15:27:28 DEBUG (MainThread) [pydeconz.websocket] {"config":{"battery":100,"enrolled":0,"on":true,"pending":[],"reachable":true,"temperature":3000},"e":"changed","id":"31","r":"sensors","t":"event","uniqueid":"00:15:8d:00:04:1d:8f:5e-01-0500"}
2021-08-25 15:27:28 DEBUG (MainThread) [pydeconz.websocket] {"attr":{"id":"13","lastannounced":null,"lastseen":"2021-08-25T12:27Z","manufacturername":"LUMI","modelid":"lumi.switch.b1lacn02","name":"Her Bath","swversion":"09-20-2018","type":"ZHAConsumption","uniqueid":"00:15:8d:00:03:ce:fe:b2-01-000c"},"e":"changed","id":"13","r":"sensors","t":"event","uniqueid":"00:15:8d:00:03:ce:fe:b2-01-000c"}
2021-08-25 15:27:31 DEBUG (MainThread) [pydeconz.websocket] {"attr":{"id":"16","lastannounced":null,"lastseen":"2021-08-25T12:27Z","manufacturername":"LUMI","modelid":"lumi.relay.c2acn01","name":"Hallway","swversion":"09-20-2018","type":"ZHAPower","uniqueid":"00:15:8d:00:03:cf:00:f6-01-0b04"},"e":"changed","id":"16","r":"sensors","t":"event","uniqueid":"00:15:8d:00:03:cf:00:f6-01-0b04"}
2021-08-25 15:27:34 DEBUG (MainThread) [pydeconz.websocket] {"attr":{"id":"17","lastannounced":"2020-10-26T15:40:05Z","lastseen":"2021-08-25T12:27Z","manufacturername":"Unknown","modelid":"lumi.relay.c2acn01","name":"Bedroom","swversion":"09-20-2018","type":"Dimmable light","uniqueid":"00:15:8d:00:04:14:77:20-02"},"e":"changed","id":"17","r":"lights","t":"event","uniqueid":"00:15:8d:00:04:14:77:20-02"}
2021-08-25 15:27:36 DEBUG (MainThread) [pydeconz.websocket] {"attr":{"id":"8","lastannounced":null,"lastseen":"2021-08-25T12:27Z","manufacturername":"LUMI","modelid":"lumi.relay.c2acn01","name":"Living Room","swversion":"09-20-2018","type":"ZHAPower","uniqueid":"00:15:8d:00:04:5c:20:99-01-0b04"},"e":"changed","id":"8","r":"sensors","t":"event","uniqueid":"00:15:8d:00:04:5c:20:99-01-0b04"}
2021-08-25 15:27:38 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback EventBus.async_listen_once.<locals>._onetime_listener(<Event homeassistant_stop[L]>) at /usr/src/homeassistant/homeassistant/core.py:820
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/core.py", line 834, in _onetime_listener
    self._hass.async_run_job(listener, event)
  File "/usr/src/homeassistant/homeassistant/core.py", line 452, in async_run_job
    return self.async_run_hass_job(HassJob(target), *args)
  File "/usr/src/homeassistant/homeassistant/core.py", line 436, in async_run_hass_job
    return self.async_add_hass_job(hassjob, *args)
  File "/usr/src/homeassistant/homeassistant/core.py", line 363, in async_add_hass_job
    task = self.loop.create_task(hassjob.target(*args))
TypeError: async_logout() takes 1 positional argument but 2 were given
2021-08-25 15:27:38 INFO (MainThread) [pydeconz.websocket] Shutting down connection to deCONZ (192.168.0.11)

Test disable deconz integration and then do a couple of restarts to see if it is actually related to Deconz

I already did - it is related to deconz but that’s about all i get in the logs. I tried to toggle lights and stuff in deconz to see if it’s got any effect but it’s not the case. I do suspect it’s a side-effect of something else and not actually an issue deconz itself has - at least not a functional one.