mirror of
https://github.com/home-assistant/core.git
synced 2025-11-10 11:29:46 +00:00
Axis devices support device registry (#22367)
* Add support for device registry * Fix test
This commit is contained in:
committed by
Martin Hjelmare
parent
646c4a7137
commit
52437f6246
@@ -81,7 +81,20 @@ class AxisBinarySensor(BinarySensorDevice):
|
||||
"""Return the class of the event."""
|
||||
return self.event.event_class
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return a unique identifier for this device."""
|
||||
return '{}-{}-{}'.format(
|
||||
self.device.serial, self.event.topic, self.event.id)
|
||||
|
||||
@property
|
||||
def should_poll(self):
|
||||
"""No polling needed."""
|
||||
return False
|
||||
|
||||
@property
|
||||
def device_info(self):
|
||||
"""Return a device description for device registry."""
|
||||
return {
|
||||
'identifiers': {(AXIS_DOMAIN, self.device.serial)}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user