Skip to content

Commit

Permalink
Fix error for zone devices
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre0512 committed Apr 15, 2023
1 parent f54b7b2 commit a957d7a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion .github/workflows/python-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
4 changes: 4 additions & 0 deletions pyhon/appliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ def appliance_type(self) -> str:

@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
Expand Down
4 changes: 3 additions & 1 deletion pyhon/hon.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import copy
from typing import List, Optional, Dict, Any
from typing_extensions import Self

Expand Down Expand Up @@ -53,9 +54,10 @@ async def _create_appliance(self, appliance_data: Dict[str, Any], zone=0) -> Non
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):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="pyhOn",
version="0.8.0b2",
version="0.8.0b3",
author="Andre Basche",
description="Control hOn devices with python",
long_description=long_description,
Expand Down

0 comments on commit a957d7a

Please sign in to comment.