From ffce593cc8bb736cfe451ee34eada7ec65596090 Mon Sep 17 00:00:00 2001 From: David Bonnes Date: Mon, 17 Jun 2019 17:27:06 +0100 Subject: [PATCH] Fix geniushub issue #24530 (via a client bump) & handle edge cases (#24546) * bump client library to workaround #24530 * bump client library to workaround #24530 2/2 * bump client library to workaround #24530 * bump client library to workaround #24530 2/2 * bugfix: ghost devices cause TypeError: 'NoneType' object is not subscriptable * bugfix: broken HW zones cause AttributeError: 'GeniusZone' object has no attribute 'temperature' * delint --- homeassistant/components/geniushub/binary_sensor.py | 3 ++- homeassistant/components/geniushub/manifest.json | 2 +- homeassistant/components/geniushub/water_heater.py | 5 ++++- requirements_all.txt | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/geniushub/binary_sensor.py b/homeassistant/components/geniushub/binary_sensor.py index cbea4147e73..c0f0d90028d 100644 --- a/homeassistant/components/geniushub/binary_sensor.py +++ b/homeassistant/components/geniushub/binary_sensor.py @@ -18,8 +18,9 @@ async def async_setup_platform(hass, config, async_add_entities, """Set up the Genius Hub sensor entities.""" client = hass.data[DOMAIN]['client'] + devices = [d for d in client.hub.device_objs if d.type is not None] switches = [GeniusBinarySensor(client, d) - for d in client.hub.device_objs if d.type[:21] in GH_IS_SWITCH] + for d in devices if d.type[:21] in GH_IS_SWITCH] async_add_entities(switches) diff --git a/homeassistant/components/geniushub/manifest.json b/homeassistant/components/geniushub/manifest.json index b2c7286a2d5..7c82ceeca44 100644 --- a/homeassistant/components/geniushub/manifest.json +++ b/homeassistant/components/geniushub/manifest.json @@ -3,7 +3,7 @@ "name": "Genius Hub", "documentation": "https://www.home-assistant.io/components/geniushub", "requirements": [ - "geniushub-client==0.4.11" + "geniushub-client==0.4.12" ], "dependencies": [], "codeowners": ["@zxdavb"] diff --git a/homeassistant/components/geniushub/water_heater.py b/homeassistant/components/geniushub/water_heater.py index 6efbed514ee..3b40bafa699 100644 --- a/homeassistant/components/geniushub/water_heater.py +++ b/homeassistant/components/geniushub/water_heater.py @@ -94,7 +94,10 @@ class GeniusWaterHeater(WaterHeaterDevice): @property def current_temperature(self): """Return the current temperature.""" - return self._boiler.temperature + try: + return self._boiler.temperature + except AttributeError: + return None @property def target_temperature(self): diff --git a/requirements_all.txt b/requirements_all.txt index c58b3bcaa45..4ba3b0ca939 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -494,7 +494,7 @@ gearbest_parser==1.0.7 geizhals==0.0.9 # homeassistant.components.geniushub -geniushub-client==0.4.11 +geniushub-client==0.4.12 # homeassistant.components.geo_json_events # homeassistant.components.nsw_rural_fire_service_feed