Add support for deCONZ alarm events in logbook (#49652)

* Add support for alarm events in logbook

* Update homeassistant/components/deconz/alarm_control_panel.py

Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
This commit is contained in:
Robert Svensson 2021-04-28 19:46:15 +02:00 committed by GitHub
parent 296dc9303f
commit 5e07ab17b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 123 additions and 8 deletions

View file

@ -20,7 +20,6 @@ from homeassistant.const import (
STATE_ALARM_ARMED_HOME,
STATE_ALARM_ARMED_NIGHT,
STATE_ALARM_DISARMED,
STATE_UNKNOWN,
)
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
@ -170,11 +169,14 @@ class DeconzAlarmEvent(DeconzEvent):
state, code, _area = self._device.action.split(",")
if state not in DECONZ_TO_ALARM_STATE:
return
data = {
CONF_ID: self.event_id,
CONF_UNIQUE_ID: self.serial,
CONF_DEVICE_ID: self.device_id,
CONF_EVENT: DECONZ_TO_ALARM_STATE.get(state, STATE_UNKNOWN),
CONF_EVENT: DECONZ_TO_ALARM_STATE[state],
CONF_CODE: code,
}