Merge pull request #5 from alexandre-leites/main

Fixing Support for H-WASHER 500
This commit is contained in:
Andre Basche 2023-03-14 18:30:30 +01:00 committed by GitHub
commit 241ee95d5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

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}

View file

@ -1,6 +1,7 @@
import importlib
from pyhon.commands import HonCommand
from pyhon.parameter import HonParameterFixed
class HonDevice:
@ -93,7 +94,7 @@ 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:
if not isinstance(data, HonParameterFixed) and parameters.get(key) is not None:
data.value = parameters.get(key)
async def load_commands(self):

View file

@ -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: