From 25fa89552deb7e9154f5c5b705668d6601005774 Mon Sep 17 00:00:00 2001 From: Vadym Melnychuk Date: Thu, 13 Jul 2023 19:34:49 +0300 Subject: [PATCH] Added ability to send specific parameters. Useful in case the command has many not mandatory parameters and you want to send only one/few --- pyhon/commands.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pyhon/commands.py b/pyhon/commands.py index 85e0988..99c3818 100644 --- a/pyhon/commands.py +++ b/pyhon/commands.py @@ -124,6 +124,18 @@ class HonCommand: self.mandatory_parameter_groups if onlyMandatory else self.parameter_groups ) 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.pop("programRules", None) self.appliance.sync_command_to_params(self.name)