Unique Ids for August entities to allow renames (#20887)
* working unique ids for august * cleanup blank lines * cleanup blank lines * cleanup blank lines * rebase * get the oneline back in * blank line stuff * whitespace cleanup * Blank Line . * blank line againpull/21013/head
parent
4cb408f8f9
commit
c3c92232da
|
@ -144,6 +144,13 @@ class AugustDoorBinarySensor(BinarySensorDevice):
|
|||
from august.lock import LockDoorStatus
|
||||
self._state = self._state == LockDoorStatus.OPEN
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
"""Get the unique of the door open binary sensor."""
|
||||
return '{:s}_{:s}'.format(self._door.device_id,
|
||||
SENSOR_TYPES_DOOR[self._sensor_type][0]
|
||||
.lower())
|
||||
|
||||
|
||||
class AugustDoorbellBinarySensor(BinarySensorDevice):
|
||||
"""Representation of an August binary sensor."""
|
||||
|
@ -182,3 +189,10 @@ class AugustDoorbellBinarySensor(BinarySensorDevice):
|
|||
state_provider = SENSOR_TYPES_DOORBELL[self._sensor_type][2]
|
||||
self._state = state_provider(self._data, self._doorbell)
|
||||
self._available = self._doorbell.is_online
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
"""Get the unique id of the doorbell sensor."""
|
||||
return '{:s}_{:s}'.format(self._doorbell.device_id,
|
||||
SENSOR_TYPES_DOORBELL[self._sensor_type][0]
|
||||
.lower())
|
||||
|
|
|
@ -74,3 +74,8 @@ class AugustCamera(Camera):
|
|||
timeout=self._timeout).content
|
||||
|
||||
return self._image_content
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
"""Get the unique id of the camera."""
|
||||
return '{:s}_camera'.format(self._doorbell.device_id)
|
||||
|
|
|
@ -95,3 +95,8 @@ class AugustLock(LockDevice):
|
|||
return {
|
||||
ATTR_BATTERY_LEVEL: self._lock_detail.battery_level,
|
||||
}
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
"""Get the unique id of the lock."""
|
||||
return '{:s}_lock'.format(self._lock.device_id)
|
||||
|
|
Loading…
Reference in New Issue