Skip to content

Commit

Permalink
Updated readme and added better update error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
dcmeglio committed Jan 7, 2023
1 parent 389fae9 commit f835a8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions README → README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# homeassistant-petsafe

[![hacs_badge](https://img.shields.io/badge/HACS-Default-41BDF5.svg?style=for-the-badge)](https://github.com/hacs/integration)
<a href="https://www.buymeacoffee.com/dcmeglio" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="28" width="119"></a>

PetSafe Integration for Home Assistant

Expand Down
12 changes: 9 additions & 3 deletions custom_components/petsafe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)
from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.exceptions import ConfigEntryAuthFailed
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed

import petsafe

Expand Down Expand Up @@ -162,7 +162,11 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:


class PetSafeData:
def __init__(self, feeders, litterboxes):
def __init__(
self,
feeders: list[petsafe.devices.DeviceSmartFeed],
litterboxes: list[petsafe.devices.DeviceScoopfree],
):
self.feeders = feeders
self.litterboxes = litterboxes

Expand Down Expand Up @@ -226,4 +230,6 @@ async def _async_update_data(self) -> PetSafeData:
if ex.response.status_code in (401, 403):
raise ConfigEntryAuthFailed() from ex
else:
raise
raise UpdateFailed() from ex
except Exception as ex:
raise UpdateFailed() from ex

0 comments on commit f835a8f

Please sign in to comment.