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 again
This commit is contained in:
parent
4cb408f8f9
commit
c3c92232da
3 changed files with 24 additions and 0 deletions
|
@ -144,6 +144,13 @@ class AugustDoorBinarySensor(BinarySensorDevice):
|
||||||
from august.lock import LockDoorStatus
|
from august.lock import LockDoorStatus
|
||||||
self._state = self._state == LockDoorStatus.OPEN
|
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):
|
class AugustDoorbellBinarySensor(BinarySensorDevice):
|
||||||
"""Representation of an August binary sensor."""
|
"""Representation of an August binary sensor."""
|
||||||
|
@ -182,3 +189,10 @@ class AugustDoorbellBinarySensor(BinarySensorDevice):
|
||||||
state_provider = SENSOR_TYPES_DOORBELL[self._sensor_type][2]
|
state_provider = SENSOR_TYPES_DOORBELL[self._sensor_type][2]
|
||||||
self._state = state_provider(self._data, self._doorbell)
|
self._state = state_provider(self._data, self._doorbell)
|
||||||
self._available = self._doorbell.is_online
|
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
|
timeout=self._timeout).content
|
||||||
|
|
||||||
return self._image_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 {
|
return {
|
||||||
ATTR_BATTERY_LEVEL: self._lock_detail.battery_level,
|
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…
Add table
Add a link
Reference in a new issue