From 96233dd7fd9e7a921fc1fd259185cbc1fda789f8 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sat, 11 Mar 2023 22:55:11 +0100 Subject: [PATCH] Handle appliances without attributes --- pyhon/device.py | 3 ++- setup.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyhon/device.py b/pyhon/device.py index eb4b9e2..e63b89d 100644 --- a/pyhon/device.py +++ b/pyhon/device.py @@ -5,7 +5,8 @@ from pyhon.commands import HonCommand class HonDevice: def __init__(self, connector, appliance): - appliance["attributes"] = {v["parName"]: v["parValue"] for v in appliance["attributes"]} + if attributes := appliance.get("attributes"): + appliance["attributes"] = {v["parName"]: v["parValue"] for v in attributes} self._appliance = appliance self._connector = connector self._appliance_model = {} diff --git a/setup.py b/setup.py index c3b4ba4..c5ea00a 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open("README.md", "r") as f: setup( name="pyhOn", - version="0.3.4", + version="0.3.5", author="Andre Basche", description="Control hOn devices with python", long_description=long_description,