Compare commits

..

11 Commits

Author SHA1 Message Date
Andre Basche f73ef26e74 Restore last command value only if possible #6 2023-03-14 23:17:36 +01:00
Andre Basche 0ddbdd0b4e Bump version to v0.3.7 2023-03-14 18:51:48 +01:00
Andre Basche 241ee95d5c Merge pull request #5 from alexandre-leites/main
Fixing Support for H-WASHER 500
2023-03-14 18:30:30 +01:00
Alexandre Leites c9d4461f8f Update commands.py to fix None values 2023-03-14 14:30:00 +01:00
Alexandre Leites 318e60e91e Update device.py trying to set fixed value from history 2023-03-14 14:29:25 +01:00
Alexandre Leites fde41ac456 Update parameter.py to fix parameter being set from history 2023-03-14 14:28:22 +01:00
Andre Basche aeabbe64e2 Bump version to v0.3.6 2023-03-13 23:08:17 +01:00
Andre Basche 7c99ffeaf7 Ignore virtual virtual wine cellar #3 2023-03-13 23:07:36 +01:00
Andre Basche 2941b57d09 Merge pull request #2 from alexandre-leites/fix/support-hw500
Fixing Support for H-WASHER 500
2023-03-13 22:32:17 +01:00
Alexandre Leites f00ee03c0d Update parameter.py to support missing parameter in some cases with HW5600 2023-03-13 03:59:42 +01:00
Alexandre Leites ec7355e341 Update api.py to correctly set firmwareId 2023-03-13 03:58:45 +01:00
5 changed files with 13 additions and 7 deletions
+4 -2
View File
@@ -55,11 +55,13 @@ class HonConnection:
appliances = (await resp.json())["payload"]["appliances"]
for appliance in appliances:
device = HonDevice(self, appliance)
if device.mac_address is None:
continue
await asyncio.gather(*[
device.load_attributes(),
device.load_commands(),
device.load_statistics()])
self._devices.append(device)
self._devices.append(device)
except json.JSONDecodeError:
_LOGGER.error("No JSON Data after GET: %s", await resp.text())
return False
@@ -70,7 +72,7 @@ class HonConnection:
"applianceType": device.appliance_type,
"code": device.appliance["code"],
"applianceModelId": device.appliance_model_id,
"firmwareId": "41",
"firmwareId": device.appliance["eepromId"],
"macAddress": device.mac_address,
"fwVersion": device.appliance["fwVersion"],
"os": const.OS,
+1 -1
View File
@@ -67,5 +67,5 @@ class HonCommand:
@property
def settings(self):
"""Parameters with typology enum and range"""
return {s: self._parameters[s] for s in self.setting_keys}
return {s: self._parameters.get(s) for s in self.setting_keys if self._parameters.get(s) is not None}
+5 -2
View File
@@ -1,6 +1,8 @@
import importlib
from contextlib import suppress
from pyhon.commands import HonCommand
from pyhon.parameter import HonParameterFixed
class HonDevice:
@@ -93,8 +95,9 @@ class HonDevice:
command.set_program(parameters.pop("program").split(".")[-1].lower())
command = self.commands[name]
for key, data in command.settings.items():
if parameters.get(key) is not None:
data.value = parameters.get(key)
if not isinstance(data, HonParameterFixed) and parameters.get(key) is not None:
with suppress(ValueError):
data.value = parameters.get(key)
async def load_commands(self):
raw = await self._connector.load_commands(self)
+2 -1
View File
@@ -30,7 +30,7 @@ class HonParameter:
class HonParameterFixed(HonParameter):
def __init__(self, key, attributes):
super().__init__(key, attributes)
self._value = attributes["fixedValue"]
self._value = attributes.get("fixedValue", None)
def __repr__(self):
return f"{self.__class__} (<{self.key}> fixed)"
@@ -75,6 +75,7 @@ class HonParameterRange(HonParameter):
@value.setter
def value(self, value):
value = int(value)
if self._min <= value <= self._max and not value % self._step:
self._value = value
else:
+1 -1
View File
@@ -7,7 +7,7 @@ with open("README.md", "r") as f:
setup(
name="pyhOn",
version="0.3.5",
version="0.3.8",
author="Andre Basche",
description="Control hOn devices with python",
long_description=long_description,