Axis change how new event is signalled (#23152)
This commit is contained in:
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):
|
||||
|
||||
@@ -140,10 +140,10 @@ class AxisNetworkDevice:
|
||||
return 'axis_add_sensor_{}'.format(self.serial)
|
||||
|
||||
@callback
|
||||
def async_event_callback(self, action, event):
|
||||
def async_event_callback(self, action, event_id):
|
||||
"""Call to configure events when initialized on event stream."""
|
||||
if action == 'add':
|
||||
async_dispatcher_send(self.hass, self.event_new_sensor, event)
|
||||
async_dispatcher_send(self.hass, self.event_new_sensor, event_id)
|
||||
|
||||
@callback
|
||||
def start(self, fut):
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"domain": "axis",
|
||||
"name": "Axis",
|
||||
"documentation": "https://www.home-assistant.io/components/axis",
|
||||
"requirements": ["axis==21"],
|
||||
"requirements": ["axis==22"],
|
||||
"dependencies": [],
|
||||
"codeowners": ["@kane610"]
|
||||
}
|
||||
Reference in new issue
Block a user