From f73ef26e7424b6602e537bd72491faadd9430e1b Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Tue, 14 Mar 2023 23:17:36 +0100 Subject: [PATCH] Restore last command value only if possible #6 --- pyhon/device.py | 4 +++- setup.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyhon/device.py b/pyhon/device.py index 54ff200..3ee62b5 100644 --- a/pyhon/device.py +++ b/pyhon/device.py @@ -1,4 +1,5 @@ import importlib +from contextlib import suppress from pyhon.commands import HonCommand from pyhon.parameter import HonParameterFixed @@ -95,7 +96,8 @@ class HonDevice: command = self.commands[name] for key, data in command.settings.items(): if not isinstance(data, HonParameterFixed) and parameters.get(key) is not None: - data.value = parameters.get(key) + with suppress(ValueError): + data.value = parameters.get(key) async def load_commands(self): raw = await self._connector.load_commands(self) diff --git a/setup.py b/setup.py index 96309c7..81cb305 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open("README.md", "r") as f: setup( name="pyhOn", - version="0.3.7", + version="0.3.8", author="Andre Basche", description="Control hOn devices with python", long_description=long_description,