From c801839efacf6b2ba6d3c617dab5cf94e98abedc Mon Sep 17 00:00:00 2001 From: functionpointer Date: Tue, 5 Sep 2023 14:26:52 +0200 Subject: [PATCH] Fix smart_call error on empty response --- pyproject.toml | 2 +- src/chargecloudapi/api.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c76f983..fa0fea9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pychargecloud" -version = "0.2.0" +version = "0.2.1" dependencies = [ "aiohttp", "yarl", diff --git a/src/chargecloudapi/api.py b/src/chargecloudapi/api.py index 2ef3b3c..a1ba838 100644 --- a/src/chargecloudapi/api.py +++ b/src/chargecloudapi/api.py @@ -56,9 +56,9 @@ async def perform_smart_api_call( ret = await self.location_by_evse_id(evse_id=evse_id, operator_id=opid) if len(ret) != 0: call_data.operator_id = opid - self.logger.info(f"found operator {opid.name}") + self.logger.info(f"{evse_id}: found operator {opid.name}") break - if ret is None: + if ret is None or len(ret)==0: return None, call_data else: return ret[0], call_data