From bab8bce8045b02f02df7df65ac742450a0a850ee Mon Sep 17 00:00:00 2001 From: Vadym Melnychuk Date: Mon, 24 Jul 2023 17:36:03 +0300 Subject: [PATCH] cleanup --- pyhon/appliance.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pyhon/appliance.py b/pyhon/appliance.py index ca0cef6..0d0064e 100644 --- a/pyhon/appliance.py +++ b/pyhon/appliance.py @@ -277,7 +277,13 @@ class HonAppliance: _LOGGER.info("Can't set %s - %s", key, error) continue - def sync_command(self, main: str, target: Optional[List[str] | str] = None) -> None: + def sync_command( + self, + main: str, + target: Optional[List[str] | str] = None, + mandatory_only: bool = False, + target_parameters: Optional[List[str]] = None, + ) -> None: base: Optional[HonCommand] = self.commands.get(main) if not base: return @@ -288,6 +294,13 @@ class HonAppliance: for name, target_param in data.parameters.items(): if not (base_param := base.parameters.get(name)): continue + + if mandatory_only and not target_param.mandatory: + continue + + if target_parameters and name not in target_parameters: + continue + self.sync_parameter(base_param, target_param) def sync_parameter(self, main: Parameter, target: Parameter) -> None: