From a957d7ac0f20832a0ff3563ab54f81c3819171c2 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sat, 15 Apr 2023 21:58:20 +0200 Subject: [PATCH] Fix error for zone devices --- .github/workflows/python-check.yml | 1 - pyhon/appliance.py | 4 ++++ pyhon/hon.py | 4 +++- setup.py | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-check.yml b/.github/workflows/python-check.yml index 6731bd8..f2b0bd0 100644 --- a/.github/workflows/python-check.yml +++ b/.github/workflows/python-check.yml @@ -33,7 +33,6 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics - name: Type check with mypy run: | - # stop the build if there are Python syntax errors or undefined names mypy pyhon/ # - name: Analysing the code with pylint # run: | diff --git a/pyhon/appliance.py b/pyhon/appliance.py index 16d2921..0549a2e 100644 --- a/pyhon/appliance.py +++ b/pyhon/appliance.py @@ -72,6 +72,10 @@ class HonAppliance: @property def mac_address(self) -> str: + return self.info.get("macAddress", "") + + @property + def unique_id(self) -> str: return self._check_name_zone("macAddress", frontend=False) @property diff --git a/pyhon/hon.py b/pyhon/hon.py index 9be1d78..9aa236c 100644 --- a/pyhon/hon.py +++ b/pyhon/hon.py @@ -1,4 +1,5 @@ import asyncio +import copy from typing import List, Optional, Dict, Any from typing_extensions import Self @@ -53,9 +54,10 @@ class Hon: self._appliances.append(appliance) async def setup(self): + 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, zone=zone + 1) + await self._create_appliance(appliance.copy(), zone=zone + 1) await self._create_appliance(appliance) async def close(self): diff --git a/setup.py b/setup.py index 80cad43..6eaa2fa 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open("README.md", "r") as f: setup( name="pyhOn", - version="0.8.0b2", + version="0.8.0b3", author="Andre Basche", description="Control hOn devices with python", long_description=long_description,