Fix geniushub spamming log with exceptions (#37067)
parent
f4528d0db2
commit
9137957cf9
|
@ -167,6 +167,7 @@ class GeniusBroker:
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
self.client = client
|
self.client = client
|
||||||
self._hub_uid = hub_uid
|
self._hub_uid = hub_uid
|
||||||
|
self._connect_error = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hub_uid(self) -> int:
|
def hub_uid(self) -> int:
|
||||||
|
@ -178,8 +179,19 @@ class GeniusBroker:
|
||||||
"""Update the geniushub client's data."""
|
"""Update the geniushub client's data."""
|
||||||
try:
|
try:
|
||||||
await self.client.update()
|
await self.client.update()
|
||||||
except aiohttp.ClientResponseError as err:
|
if self._connect_error:
|
||||||
_LOGGER.warning("Update failed, message is: %s", err)
|
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
|
return
|
||||||
self.make_debug_log_entries()
|
self.make_debug_log_entries()
|
||||||
|
|
||||||
|
@ -240,7 +252,6 @@ class GeniusDevice(GeniusEntity):
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self) -> Dict[str, Any]:
|
def device_state_attributes(self) -> Dict[str, Any]:
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
|
|
||||||
attrs = {}
|
attrs = {}
|
||||||
attrs["assigned_zone"] = self._device.data["assignedZones"][0]["name"]
|
attrs["assigned_zone"] = self._device.data["assignedZones"][0]["name"]
|
||||||
if self._last_comms:
|
if self._last_comms:
|
||||||
|
|
Loading…
Reference in New Issue