Skip to content

Commit

Permalink
Merge pull request #298 from functionpointer/fix-unavailable
Browse files Browse the repository at this point in the history
Fix going unavailable
  • Loading branch information
vinteo authored Aug 2, 2024
2 parents 539cace + 18990f8 commit 6a5928a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions custom_components/opensprinkler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.entity_platform import async_get_platforms
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from homeassistant.helpers.update_coordinator import (
ConfigEntryAuthFailed,
DataUpdateCoordinator,
UpdateFailed,
)
from homeassistant.util import slugify
from homeassistant.util.dt import utc_from_timestamp
from pyopensprinkler import Controller as OpenSprinkler
Expand Down Expand Up @@ -76,14 +80,14 @@ async def async_update_data():
async with async_timeout.timeout(TIMEOUT):
try:
await controller.refresh()
except OpenSprinklerAuthError as e:
# wrong password, tell user to re-enter the password
raise ConfigEntryAuthFailed from e
except (
InvalidURL,
OpenSprinklerConnectionError,
OpenSprinklerAuthError,
) as e:
_LOGGER.error(e)
except Exception as e:
_LOGGER.exception(e)
raise UpdateFailed from e

if not controller._state:
raise UpdateFailed("Error fetching OpenSprinkler state")
Expand Down

0 comments on commit 6a5928a

Please sign in to comment.