diff --git a/homeassistant/components/geniushub/__init__.py b/homeassistant/components/geniushub/__init__.py index 0b99224bf7f..16967fb265a 100644 --- a/homeassistant/components/geniushub/__init__.py +++ b/homeassistant/components/geniushub/__init__.py @@ -167,6 +167,7 @@ class GeniusBroker: self.hass = hass self.client = client self._hub_uid = hub_uid + self._connect_error = False @property def hub_uid(self) -> int: @@ -178,8 +179,19 @@ class GeniusBroker: """Update the geniushub client's data.""" try: await self.client.update() - except aiohttp.ClientResponseError as err: - _LOGGER.warning("Update failed, message is: %s", err) + if self._connect_error: + self._connect_error = False + _LOGGER.warning("Connection to geniushub re-established") + except ( + aiohttp.ClientResponseError, + aiohttp.client_exceptions.ClientConnectorError, + ) as err: + if not self._connect_error: + self._connect_error = True + _LOGGER.warning( + "Connection to geniushub failed (unable to update), message is: %s", + err, + ) return self.make_debug_log_entries() @@ -240,7 +252,6 @@ class GeniusDevice(GeniusEntity): @property def device_state_attributes(self) -> Dict[str, Any]: """Return the device state attributes.""" - attrs = {} attrs["assigned_zone"] = self._device.data["assignedZones"][0]["name"] if self._last_comms: