Fix error for zone devices

This commit is contained in:
Andre Basche 2023-04-15 21:58:20 +02:00
parent f54b7b2dbf
commit a957d7ac0f
4 changed files with 8 additions and 3 deletions

View File

@ -33,7 +33,6 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
- name: Type check with mypy - name: Type check with mypy
run: | run: |
# stop the build if there are Python syntax errors or undefined names
mypy pyhon/ mypy pyhon/
# - name: Analysing the code with pylint # - name: Analysing the code with pylint
# run: | # run: |

View File

@ -72,6 +72,10 @@ class HonAppliance:
@property @property
def mac_address(self) -> str: def mac_address(self) -> str:
return self.info.get("macAddress", "")
@property
def unique_id(self) -> str:
return self._check_name_zone("macAddress", frontend=False) return self._check_name_zone("macAddress", frontend=False)
@property @property

View File

@ -1,4 +1,5 @@
import asyncio import asyncio
import copy
from typing import List, Optional, Dict, Any from typing import List, Optional, Dict, Any
from typing_extensions import Self from typing_extensions import Self
@ -53,9 +54,10 @@ class Hon:
self._appliances.append(appliance) self._appliances.append(appliance)
async def setup(self): async def setup(self):
appliance: Dict
for appliance in (await self._api.load_appliances())["payload"]["appliances"]: for appliance in (await self._api.load_appliances())["payload"]["appliances"]:
for zone in range(int(appliance.get("zone", "0"))): 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) await self._create_appliance(appliance)
async def close(self): async def close(self):

View File

@ -7,7 +7,7 @@ with open("README.md", "r") as f:
setup( setup(
name="pyhOn", name="pyhOn",
version="0.8.0b2", version="0.8.0b3",
author="Andre Basche", author="Andre Basche",
description="Control hOn devices with python", description="Control hOn devices with python",
long_description=long_description, long_description=long_description,