From 46bbca0f5551834667eb48810b11b6fd39b9531d Mon Sep 17 00:00:00 2001 From: Jafar Atili Date: Fri, 5 May 2023 14:08:24 +0300 Subject: [PATCH] fix: handle cu returning no devices --- pyproject.toml | 2 +- src/switchbee/api/central_unit.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b8384ed..7900e0c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "pyswitchbee" -version = "1.7.24" +version = "1.7.25" description = "SwitchBee Python Integration." readme = "README.md" authors = [{ name = "Jafar Atili", email = "at.jafar@outlook.com" }] diff --git a/src/switchbee/api/central_unit.py b/src/switchbee/api/central_unit.py index 0fcc963..641b834 100644 --- a/src/switchbee/api/central_unit.py +++ b/src/switchbee/api/central_unit.py @@ -453,6 +453,11 @@ async def fetch_states( ] ) + if not states: + logger.debug('get_multiple_states returned empty dict') + return + + for device_state in states[ApiAttribute.DATA]: device_id = device_state[ApiAttribute.ID]