Skip to content

Commit

Permalink
Fix tests after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
davet2001 committed Jul 13, 2022
1 parent fa52ffe commit 9b24350
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions homeassistant/components/aurora_abb_powerone/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import logging

from aurorapy.client import AuroraSerialClient
from aurorapy.client import AuroraError, AuroraSerialClient, AuroraTimeoutError

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ADDRESS, CONF_PORT, Platform
Expand Down Expand Up @@ -83,21 +83,14 @@ async def _async_update_data(self) -> dict[str, float]:
self.available = True
self.data = data

except AuroraTimeoutError:
self.data = {}
self.available = False
_LOGGER.debug("No response from inverter (could be dark)")
except AuroraError as error:
self.data = {}
self.available = False
# aurorapy does not have different exceptions (yet) for dealing
# with timeout vs other comms errors.
# This means the (normal) situation of no response during darkness
# raises an exception.
# aurorapy (gitlab) pull request merged 29/5/2019. When >0.2.6 is
# released, this could be modified to :
# except AuroraTimeoutError as e:
# Workaround: look at the text of the exception
if "No response after" in str(error):
_LOGGER.debug("No response from inverter (could be dark)")
else:
raise error
raise error
finally:
if self.available != self.available_prev:
if self.available:
Expand Down

0 comments on commit 9b24350

Please sign in to comment.