mirror of
https://github.com/Andre0512/pyhOn.git
synced 2024-01-19 02:50:44 +00:00
expose ancillary parameter in settings
This commit is contained in:
parent
5b91747ec1
commit
8372c75e30
|
@ -175,7 +175,9 @@ class HonAppliance:
|
|||
def parameters(self):
|
||||
result = {}
|
||||
for name, command in self._commands.items():
|
||||
for key, parameter in command.parameters.items():
|
||||
for key, parameter in (
|
||||
command.parameters | command.ancillary_parameters
|
||||
).items():
|
||||
result.setdefault(name, {})[key] = parameter.value
|
||||
return result
|
||||
|
||||
|
|
|
@ -58,11 +58,8 @@ class HonCommand:
|
|||
return self._parameters
|
||||
|
||||
@property
|
||||
def ancillary_parameters(self) -> Dict[str, str | float]:
|
||||
return {
|
||||
key: parameter.value
|
||||
for key, parameter in self._ancillary_parameters.items()
|
||||
}
|
||||
def ancillary_parameters(self) -> Dict[str, HonParameter]:
|
||||
return self._ancillary_parameters
|
||||
|
||||
async def send(self) -> bool:
|
||||
parameters = {
|
||||
|
@ -90,7 +87,9 @@ class HonCommand:
|
|||
if command is None:
|
||||
command = self
|
||||
keys = []
|
||||
for key, parameter in command._parameters.items():
|
||||
for key, parameter in (
|
||||
command._parameters | command._ancillary_parameters
|
||||
).items():
|
||||
if isinstance(parameter, HonParameterFixed):
|
||||
continue
|
||||
if key not in keys:
|
||||
|
@ -115,4 +114,5 @@ class HonCommand:
|
|||
s: param
|
||||
for s in self.setting_keys
|
||||
if (param := self._parameters.get(s)) is not None
|
||||
or (param := self._ancillary_parameters.get(s)) is not None
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ def create_command(commands, concat=False):
|
|||
for name, command in commands.items():
|
||||
if not concat:
|
||||
result[name] = {}
|
||||
for parameter, data in command.parameters.items():
|
||||
for parameter, data in command.settings.items():
|
||||
if data.typology == "enum":
|
||||
value = data.values
|
||||
elif data.typology == "range":
|
||||
|
|
Loading…
Reference in a new issue