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:
Brian Towles 2019-02-11 13:48:02 -06:00 committed by Charles Garwood
parent 4cb408f8f9
commit c3c92232da
3 changed files with 24 additions and 0 deletions

View file

@ -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())