From 853380485984cfea3898a02a8e6b52d7330e0bff Mon Sep 17 00:00:00 2001 From: "Dr. Drinovac" <52541649+RobertD502@users.noreply.github.com> Date: Mon, 4 Nov 2024 16:26:46 -0500 Subject: [PATCH 1/2] use renamed function when device_query used during config flow --- custom_components/petkit/util.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/custom_components/petkit/util.py b/custom_components/petkit/util.py index f3f507f..bf28d97 100644 --- a/custom_components/petkit/util.py +++ b/custom_components/petkit/util.py @@ -30,7 +30,7 @@ async def async_validate_api(hass: HomeAssistant, email: str, password: str, reg ) try: async with async_timeout.timeout(TIMEOUT): - devices_query = await client.get_device_roster() + devices_query = await client.get_device_rosters() except AuthError as err: LOGGER.error(f'Could not authenticate on PetKit servers: {err}') raise AuthError(err) @@ -51,9 +51,10 @@ async def async_validate_api(hass: HomeAssistant, email: str, password: str, reg LOGGER.error(f'Failed to get information from PetKit servers: {err}') raise ConnectionError from err - devices: dict[str, Any] = devices_query['result']['devices'] + devices = sum(len(value['result']['devices']) for value in devices_query.values()) - if not devices: + + if devices == 0: LOGGER.error("Could not retrieve any devices from PetKit servers") raise NoDevicesError return True From 13b215be82412f414fc9a205b651f78534a6b16e Mon Sep 17 00:00:00 2001 From: "Dr. Drinovac" <52541649+RobertD502@users.noreply.github.com> Date: Mon, 4 Nov 2024 16:27:28 -0500 Subject: [PATCH 2/2] bump integration to 0.1.12.2 --- custom_components/petkit/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/petkit/manifest.json b/custom_components/petkit/manifest.json index fe0c4f7..1ae47cb 100644 --- a/custom_components/petkit/manifest.json +++ b/custom_components/petkit/manifest.json @@ -14,5 +14,5 @@ "petkitaio==0.1.11.2", "tzlocal==5.1" ], - "version": "0.1.12.1" + "version": "0.1.12.2" }