Axis change how new event is signalled (#23152)

This commit is contained in:
Robert Svensson authored and GitHub committed 2019-04-17 15:21:42 +02:00
1 parent e114ae9b53
commit 0b7e62f737
6 files changed
+10 -9

No files matched your search

@@ -18,8 +18,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
device = hass.data[AXIS_DOMAIN][serial_number]
@callback
def async_add_sensor(event):
def async_add_sensor(event_id):
"""Add binary sensor from Axis device."""
event = device.api.event.events[event_id]
async_add_entities([AxisBinarySensor(event, device)], True)
device.listeners.append(async_dispatcher_connect(
@@ -83,12 +84,12 @@ class AxisBinarySensor(BinarySensorDevice):
def name(self):
"""Return the name of the event."""
return '{} {} {}'.format(
self.device.name, self.event.event_type, self.event.id)
self.device.name, self.event.TYPE, self.event.id)
@property
def device_class(self):
"""Return the class of the event."""
return self.event.event_class
return self.event.CLASS
@property
def unique_id(self):