From e234ef3bbb7a7a77e78ff657c3bd846d19c48ec9 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sun, 9 Jul 2023 01:36:03 +0200 Subject: [PATCH 1/6] Remove old code in ov hon#88 --- pyhon/appliances/ov.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pyhon/appliances/ov.py b/pyhon/appliances/ov.py index f406ad4..77478cf 100644 --- a/pyhon/appliances/ov.py +++ b/pyhon/appliances/ov.py @@ -14,11 +14,4 @@ class Appliance(ApplianceBase): data["parameters"]["remainingTimeMM"].value = "0" data["active"] = data["parameters"]["onOffStatus"] == "1" - - if program := int(data["parameters"]["prCode"].value): - if (setting := self.parent.settings["startProgram.program"]) and isinstance( - setting, HonParameterProgram - ): - data["programName"] = setting.ids.get(program, "") - return data From 3d5c8405eab058d1590d59f53dcca2836cb63dc9 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sun, 9 Jul 2023 23:58:55 +0200 Subject: [PATCH 2/6] Improve error handling --- pyhon/appliance.py | 2 +- pyhon/connection/api.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pyhon/appliance.py b/pyhon/appliance.py index a61a362..f1ef65e 100644 --- a/pyhon/appliance.py +++ b/pyhon/appliance.py @@ -109,7 +109,7 @@ class HonAppliance: @property def nick_name(self) -> str: result = self._check_name_zone("nickName") - if not result or re.findall("^[xX1\\s]+$", result): + if not result or re.findall("^[xX1\\s-]+$", result): return self.model_name return result diff --git a/pyhon/connection/api.py b/pyhon/connection/api.py index a4a45f1..364bbb6 100644 --- a/pyhon/connection/api.py +++ b/pyhon/connection/api.py @@ -267,8 +267,13 @@ class TestAPI(HonAPI): _LOGGER.warning("Can't open %s", str(path)) return {} with open(path, "r", encoding="utf-8") as json_file: - data: Dict[str, Any] = json.loads(json_file.read()) - return data + text = json_file.read() + try: + data: Dict[str, Any] = json.loads(text) + return data + except json.decoder.JSONDecodeError as error: + _LOGGER.error("%s - %s", str(path), error) + return {} async def load_appliances(self) -> List[Dict[str, Any]]: result = [] From f1818bbc5d5489dd6ccbeba31cc9690e320c5121 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sun, 9 Jul 2023 23:59:27 +0200 Subject: [PATCH 3/6] Bump version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index aff5f75..4118516 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open("README.md", "r") as f: setup( name="pyhOn", - version="0.14.7", + version="0.14.8", author="Andre Basche", description="Control hOn devices with python", long_description=long_description, From 9a6a07fd46ba274f38b1c0cdb62c751403163b85 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Mon, 10 Jul 2023 23:58:24 +0200 Subject: [PATCH 4/6] Sync enum values of commands --- pyhon/appliance.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyhon/appliance.py b/pyhon/appliance.py index f1ef65e..05b4b8d 100644 --- a/pyhon/appliance.py +++ b/pyhon/appliance.py @@ -11,6 +11,7 @@ from pyhon.attributes import HonAttribute from pyhon.command_loader import HonCommandLoader from pyhon.commands import HonCommand from pyhon.parameter.base import HonParameter +from pyhon.parameter.enum import HonParameterEnum from pyhon.parameter.range import HonParameterRange from pyhon.typedefs import Parameter @@ -283,4 +284,6 @@ class HonAppliance: parameter.max = int(base_value.value) parameter.min = int(base_value.value) parameter.step = 1 + elif isinstance(parameter, HonParameterEnum): + parameter.values = base_value.values parameter.value = base_value.value From 8ca40d7ad02b2b1e078a2fbec97353ce50c2f850 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Mon, 10 Jul 2023 23:59:55 +0200 Subject: [PATCH 5/6] Add missing requirement typing-extensions --- requirements.txt | 1 + setup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9ba048c..21a8fea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ aiohttp==3.8.4 yarl==1.8.2 +typing-extensions=4.7.1 diff --git a/setup.py b/setup.py index 4118516..3aa978d 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ setup( packages=find_packages(), include_package_data=True, python_requires=">=3.10", - install_requires=["aiohttp"], + install_requires=["aiohttp", "typing-extensions"], classifiers=[ "Development Status :: 4 - Beta", "Environment :: Console", From bc7e8994c90c613c43844183a7041d473efbba8c Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Tue, 11 Jul 2023 00:00:25 +0200 Subject: [PATCH 6/6] Bump version --- requirements.txt | 2 +- setup.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 21a8fea..5c21de6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ aiohttp==3.8.4 yarl==1.8.2 -typing-extensions=4.7.1 +typing-extensions==4.7.1 diff --git a/setup.py b/setup.py index 3aa978d..0b5a130 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open("README.md", "r") as f: setup( name="pyhOn", - version="0.14.8", + version="0.14.9", author="Andre Basche", description="Control hOn devices with python", long_description=long_description, @@ -21,7 +21,7 @@ setup( packages=find_packages(), include_package_data=True, python_requires=">=3.10", - install_requires=["aiohttp", "typing-extensions"], + install_requires=["aiohttp==3.8.4", "typing-extensions==4.7.1"], classifiers=[ "Development Status :: 4 - Beta", "Environment :: Console",