From 6c44aa895d64db59e11e8508ba5a3b2c8fb0bba9 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sun, 16 Apr 2023 13:31:19 +0200 Subject: [PATCH] Disable zones for devices with just 1 zone, fixes #11 --- pyhon/hon.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyhon/hon.py b/pyhon/hon.py index 830d510..bffa246 100644 --- a/pyhon/hon.py +++ b/pyhon/hon.py @@ -61,8 +61,9 @@ class Hon: async def setup(self) -> None: appliance: Dict for appliance in (await self.api.load_appliances())["payload"]["appliances"]: - for zone in range(int(appliance.get("zone", "0"))): - await self._create_appliance(appliance.copy(), zone=zone + 1) + if (zones := int(appliance.get("zone", "0"))) > 1: + for zone in range(zones): + await self._create_appliance(appliance.copy(), zone=zone + 1) await self._create_appliance(appliance) async def close(self) -> None: