From 6e340154203d39178e35e9a5893cb3350689629b Mon Sep 17 00:00:00 2001 From: Robert Svensson Date: Fri, 3 May 2019 17:55:42 +0200 Subject: [PATCH] deCONZ - Retry on BridgeBusy errors (#23436) --- homeassistant/components/deconz/cover.py | 4 ++++ homeassistant/components/deconz/deconz_device.py | 2 ++ homeassistant/components/deconz/light.py | 2 ++ homeassistant/components/deconz/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 6 files changed, 11 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/deconz/cover.py b/homeassistant/components/deconz/cover.py index 45a1b0c67e5..aa29e8c6b58 100644 --- a/homeassistant/components/deconz/cover.py +++ b/homeassistant/components/deconz/cover.py @@ -88,9 +88,11 @@ class DeconzCover(DeconzDevice, CoverDevice): """Move the cover to a specific position.""" position = kwargs[ATTR_POSITION] data = {'on': False} + if position > 0: data['on'] = True data['bri'] = int(position / 100 * 255) + await self._device.async_set_state(data) async def async_open_cover(self, **kwargs): @@ -126,7 +128,9 @@ class DeconzCoverZigbeeSpec(DeconzCover): """Move the cover to a specific position.""" position = kwargs[ATTR_POSITION] data = {'on': False} + if position < 100: data['on'] = True data['bri'] = 255 - int(position / 100 * 255) + await self._device.async_set_state(data) diff --git a/homeassistant/components/deconz/deconz_device.py b/homeassistant/components/deconz/deconz_device.py index 6923c93dd6f..73ac2499cd3 100644 --- a/homeassistant/components/deconz/deconz_device.py +++ b/homeassistant/components/deconz/deconz_device.py @@ -61,8 +61,10 @@ class DeconzDevice(Entity): if (self._device.uniqueid is None or self._device.uniqueid.count(':') != 7): return None + serial = self._device.uniqueid.split('-', 1)[0] bridgeid = self.gateway.api.config.bridgeid + return { 'connections': {(CONNECTION_ZIGBEE, serial)}, 'identifiers': {(DECONZ_DOMAIN, serial)}, diff --git a/homeassistant/components/deconz/light.py b/homeassistant/components/deconz/light.py index 7514162fefa..c195703c36a 100644 --- a/homeassistant/components/deconz/light.py +++ b/homeassistant/components/deconz/light.py @@ -165,6 +165,8 @@ class DeconzLight(DeconzDevice, Light): """Return the device state attributes.""" attributes = {} attributes['is_deconz_group'] = self._device.type == 'LightGroup' + if self._device.type == 'LightGroup': attributes['all_on'] = self._device.all_on + return attributes diff --git a/homeassistant/components/deconz/manifest.json b/homeassistant/components/deconz/manifest.json index 588bd23410c..22947d40fb1 100644 --- a/homeassistant/components/deconz/manifest.json +++ b/homeassistant/components/deconz/manifest.json @@ -3,7 +3,7 @@ "name": "Deconz", "documentation": "https://www.home-assistant.io/components/deconz", "requirements": [ - "pydeconz==55" + "pydeconz==58" ], "dependencies": [], "codeowners": [ diff --git a/requirements_all.txt b/requirements_all.txt index b52cfe3bfbe..9f319d9e528 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1018,7 +1018,7 @@ pydaikin==1.4.0 pydanfossair==0.1.0 # homeassistant.components.deconz -pydeconz==55 +pydeconz==58 # homeassistant.components.zwave pydispatcher==2.0.5 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index b402b9bd009..31f0aeef453 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -223,7 +223,7 @@ pyHS100==0.3.5 pyblackbird==0.5 # homeassistant.components.deconz -pydeconz==55 +pydeconz==58 # homeassistant.components.zwave pydispatcher==2.0.5