Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unique Ids for August entities to allow renames #20887

Merged
merged 11 commits into from
Feb 11, 2019
14 changes: 14 additions & 0 deletions homeassistant/components/august/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ def update(self):
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."""
Expand Down Expand Up @@ -182,3 +189,10 @@ def update(self):
state_provider = SENSOR_TYPES_DOORBELL[self._sensor_type][2]
self._state = state_provider(self._data, self._doorbell)
self._available = self._doorbell.is_online

@property
wonderslug marked this conversation as resolved.
Show resolved Hide resolved
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())
5 changes: 5 additions & 0 deletions homeassistant/components/august/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,8 @@ def camera_image(self):
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)
5 changes: 5 additions & 0 deletions homeassistant/components/august/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,8 @@ def device_state_attributes(self):
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)