Skip to content

Commit

Permalink
Added ability to send specific parameters. Useful in case the command…
Browse files Browse the repository at this point in the history
… has many not mandatory parameters and you want to send only one/few
  • Loading branch information
Vadym Melnychuk committed Jul 13, 2023
1 parent 68b6b7b commit 25fa895
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pyhon/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ async def send(self, onlyMandatory: bool = False) -> bool:
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)
Expand Down

0 comments on commit 25fa895

Please sign in to comment.