From d1540aed996ca414f820d5015e2e7e540ada738f Mon Sep 17 00:00:00 2001 From: Brian Towles Date: Fri, 8 Feb 2019 22:37:46 -0600 Subject: [PATCH 01/10] working unique ids for august --- homeassistant/components/august/binary_sensor.py | 16 ++++++++++++++++ homeassistant/components/august/camera.py | 5 +++++ homeassistant/components/august/lock.py | 6 ++++++ 3 files changed, 27 insertions(+) diff --git a/homeassistant/components/august/binary_sensor.py b/homeassistant/components/august/binary_sensor.py index 4116a791b01cd5..42d913aea1939b 100644 --- a/homeassistant/components/august/binary_sensor.py +++ b/homeassistant/components/august/binary_sensor.py @@ -143,6 +143,14 @@ 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): @@ -182,3 +190,11 @@ def update(self): state_provider = SENSOR_TYPES_DOORBELL[self._sensor_type][2] self._state = state_provider(self._data, self._doorbell) self._available = self._state is not None + + @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 dcce5e13588c11..c62a32342dcea8 100644 --- a/homeassistant/components/august/camera.py +++ b/homeassistant/components/august/camera.py @@ -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) diff --git a/homeassistant/components/august/lock.py b/homeassistant/components/august/lock.py index ce6792ceb39d39..866195bb1f6d66 100644 --- a/homeassistant/components/august/lock.py +++ b/homeassistant/components/august/lock.py @@ -95,3 +95,9 @@ 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) + From 2b114677eea8a0d812c1e59a8c189839fa13df5d Mon Sep 17 00:00:00 2001 From: Brian Towles Date: Fri, 8 Feb 2019 22:49:37 -0600 Subject: [PATCH 02/10] cleanup blank lines --- homeassistant/components/august/binary_sensor.py | 2 +- homeassistant/components/august/lock.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/homeassistant/components/august/binary_sensor.py b/homeassistant/components/august/binary_sensor.py index 42d913aea1939b..2cb067c616185a 100644 --- a/homeassistant/components/august/binary_sensor.py +++ b/homeassistant/components/august/binary_sensor.py @@ -197,4 +197,4 @@ def unique_id(self) -> str: return '{:s}_{:s}'.format(self._doorbell.device_id, SENSOR_TYPES_DOORBELL[self._sensor_type][0] .lower()) - + diff --git a/homeassistant/components/august/lock.py b/homeassistant/components/august/lock.py index 866195bb1f6d66..e83641709800c3 100644 --- a/homeassistant/components/august/lock.py +++ b/homeassistant/components/august/lock.py @@ -100,4 +100,3 @@ def device_state_attributes(self): def unique_id(self) -> str: """Get the unique id of the lock.""" return '{:s}_lock'.format(self._lock.device_id) - From 60efc7a7310a8bb3100cb5f0627edb8be1748dff Mon Sep 17 00:00:00 2001 From: Brian Towles Date: Fri, 8 Feb 2019 22:53:27 -0600 Subject: [PATCH 03/10] cleanup blank lines --- homeassistant/components/august/binary_sensor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/homeassistant/components/august/binary_sensor.py b/homeassistant/components/august/binary_sensor.py index 2cb067c616185a..c4e2a8bdbb5a70 100644 --- a/homeassistant/components/august/binary_sensor.py +++ b/homeassistant/components/august/binary_sensor.py @@ -197,4 +197,3 @@ def unique_id(self) -> str: return '{:s}_{:s}'.format(self._doorbell.device_id, SENSOR_TYPES_DOORBELL[self._sensor_type][0] .lower()) - From 6d6a2db39c2ff9521c86dfc317a50f8700c297de Mon Sep 17 00:00:00 2001 From: Brian Towles Date: Fri, 8 Feb 2019 22:54:23 -0600 Subject: [PATCH 04/10] cleanup blank lines --- homeassistant/components/august/binary_sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/august/binary_sensor.py b/homeassistant/components/august/binary_sensor.py index c4e2a8bdbb5a70..4aa14ef1c94564 100644 --- a/homeassistant/components/august/binary_sensor.py +++ b/homeassistant/components/august/binary_sensor.py @@ -143,7 +143,7 @@ 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.""" From 55b061aefaaca5cd3e3a78b58f03b33e5f437ed8 Mon Sep 17 00:00:00 2001 From: Brian Towles Date: Sat, 9 Feb 2019 10:43:34 -0600 Subject: [PATCH 05/10] rebase --- homeassistant/components/august/binary_sensor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/august/binary_sensor.py b/homeassistant/components/august/binary_sensor.py index 4aa14ef1c94564..2cb067c616185a 100644 --- a/homeassistant/components/august/binary_sensor.py +++ b/homeassistant/components/august/binary_sensor.py @@ -143,7 +143,7 @@ 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.""" @@ -197,3 +197,4 @@ def unique_id(self) -> str: return '{:s}_{:s}'.format(self._doorbell.device_id, SENSOR_TYPES_DOORBELL[self._sensor_type][0] .lower()) + From 00569fa01cee212697fa5b18e7392da4dbb48b63 Mon Sep 17 00:00:00 2001 From: Brian Towles Date: Sat, 9 Feb 2019 10:44:42 -0600 Subject: [PATCH 06/10] get the oneline back in --- homeassistant/components/august/binary_sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/august/binary_sensor.py b/homeassistant/components/august/binary_sensor.py index 2cb067c616185a..f25f105eca8456 100644 --- a/homeassistant/components/august/binary_sensor.py +++ b/homeassistant/components/august/binary_sensor.py @@ -189,7 +189,7 @@ def update(self): """Get the latest state of the sensor.""" state_provider = SENSOR_TYPES_DOORBELL[self._sensor_type][2] self._state = state_provider(self._data, self._doorbell) - self._available = self._state is not None + self._available = self._doorbell.is_online @property def unique_id(self) -> str: From 3448cfd39f0e1105c2915df64e194881ba46d8a0 Mon Sep 17 00:00:00 2001 From: Brian Towles Date: Sat, 9 Feb 2019 10:45:26 -0600 Subject: [PATCH 07/10] blank line stuff --- homeassistant/components/august/binary_sensor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/homeassistant/components/august/binary_sensor.py b/homeassistant/components/august/binary_sensor.py index f25f105eca8456..4b280527f64421 100644 --- a/homeassistant/components/august/binary_sensor.py +++ b/homeassistant/components/august/binary_sensor.py @@ -197,4 +197,3 @@ def unique_id(self) -> str: return '{:s}_{:s}'.format(self._doorbell.device_id, SENSOR_TYPES_DOORBELL[self._sensor_type][0] .lower()) - From c3e8cade7919eca6d50fb21e56ef2ca4ea8377f8 Mon Sep 17 00:00:00 2001 From: Brian Towles Date: Sat, 9 Feb 2019 10:46:54 -0600 Subject: [PATCH 08/10] whitespace cleanup --- homeassistant/components/august/binary_sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/august/binary_sensor.py b/homeassistant/components/august/binary_sensor.py index 4b280527f64421..395569242ad156 100644 --- a/homeassistant/components/august/binary_sensor.py +++ b/homeassistant/components/august/binary_sensor.py @@ -143,7 +143,7 @@ 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.""" From 73fc79bc1423bdc0f7e9e049a79b091cab219f87 Mon Sep 17 00:00:00 2001 From: Brian Towles Date: Sat, 9 Feb 2019 12:28:59 -0600 Subject: [PATCH 09/10] Blank Line . --- homeassistant/components/august/binary_sensor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/homeassistant/components/august/binary_sensor.py b/homeassistant/components/august/binary_sensor.py index 4ae382507056e0..395569242ad156 100644 --- a/homeassistant/components/august/binary_sensor.py +++ b/homeassistant/components/august/binary_sensor.py @@ -190,6 +190,7 @@ 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 def unique_id(self) -> str: """Get the unique id of the doorbell sensor.""" From 2210f11f7210be5a962c4d5cca94c06f48930b1c Mon Sep 17 00:00:00 2001 From: Brian Towles Date: Sat, 9 Feb 2019 15:39:34 -0600 Subject: [PATCH 10/10] blank line again --- homeassistant/components/august/binary_sensor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/homeassistant/components/august/binary_sensor.py b/homeassistant/components/august/binary_sensor.py index 395569242ad156..c059f4c020aa37 100644 --- a/homeassistant/components/august/binary_sensor.py +++ b/homeassistant/components/august/binary_sensor.py @@ -152,7 +152,6 @@ def unique_id(self) -> str: .lower()) - class AugustDoorbellBinarySensor(BinarySensorDevice): """Representation of an August binary sensor."""