From c3c92232da042392cb7a49c993ceed499260e0ca Mon Sep 17 00:00:00 2001 From: Brian Towles Date: Mon, 11 Feb 2019 13:48:02 -0600 Subject: [PATCH] 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 --- homeassistant/components/august/binary_sensor.py | 14 ++++++++++++++ homeassistant/components/august/camera.py | 5 +++++ homeassistant/components/august/lock.py | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/homeassistant/components/august/binary_sensor.py b/homeassistant/components/august/binary_sensor.py index 581b7a3e0df..c059f4c020a 100644 --- a/homeassistant/components/august/binary_sensor.py +++ b/homeassistant/components/august/binary_sensor.py @@ -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()) diff --git a/homeassistant/components/august/camera.py b/homeassistant/components/august/camera.py index dcce5e13588..c62a32342dc 100644 --- a/homeassistant/components/august/camera.py +++ b/homeassistant/components/august/camera.py @@ -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) diff --git a/homeassistant/components/august/lock.py b/homeassistant/components/august/lock.py index ce6792ceb39..e8364170980 100644 --- a/homeassistant/components/august/lock.py +++ b/homeassistant/components/august/lock.py @@ -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)