Added ability to send specific parameters. Useful in case the command has many not mandatory parameters and you want to send only one/few

This commit is contained in:
Vadym Melnychuk 2023-07-13 19:34:49 +03:00
parent 68b6b7b24d
commit 25fa89552d

View File

@ -124,6 +124,18 @@ class HonCommand:
self.mandatory_parameter_groups if onlyMandatory else self.parameter_groups self.mandatory_parameter_groups if onlyMandatory else self.parameter_groups
) )
params = grouped_params.get("parameters", {}) params = grouped_params.get("parameters", {})
return await self.send_parameters(params)
async def send_specific(self, param_names: List[str]) -> bool:
params: Dict[str, str | float] = {}
for key, parameter in self._parameters:
if key in param_names:
params[key] = parameter.value
return await self.send_parameters(params)
async def send_parameters(self, params: Dict[str, str | float]) -> bool:
ancillary_params = self.parameter_groups.get("ancillaryParameters", {}) ancillary_params = self.parameter_groups.get("ancillaryParameters", {})
ancillary_params.pop("programRules", None) ancillary_params.pop("programRules", None)
self.appliance.sync_command_to_params(self.name) self.appliance.sync_command_to_params(self.name)