Explicitly pass in the config_entry in surepetcare coordinator (#137926)

explicitly pass in the config_entry in coordinator
This commit is contained in:
Michael 2025-02-08 21:12:10 +01:00 committed by GitHub
parent 5871ece4df
commit 022119e74f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -38,8 +38,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
try:
hass.data[DOMAIN][entry.entry_id] = coordinator = SurePetcareDataCoordinator(
entry,
hass,
entry,
)
except SurePetcareAuthenticationError as error:
_LOGGER.error("Unable to connect to surepetcare.io: Wrong credentials!")

View File

@ -33,7 +33,9 @@ SCAN_INTERVAL = timedelta(minutes=3)
class SurePetcareDataCoordinator(DataUpdateCoordinator[dict[int, SurepyEntity]]):
"""Handle Surepetcare data."""
def __init__(self, entry: ConfigEntry, hass: HomeAssistant) -> None:
config_entry: ConfigEntry
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Initialize the data handler."""
self.surepy = Surepy(
entry.data[CONF_USERNAME],
@ -51,6 +53,7 @@ class SurePetcareDataCoordinator(DataUpdateCoordinator[dict[int, SurepyEntity]])
super().__init__(
hass,
_LOGGER,
config_entry=entry,
name=DOMAIN,
update_interval=SCAN_INTERVAL,
)