From 55966dd52ffcd7b1aba6faa9f579408448c281fb Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Wed, 21 Jun 2023 18:02:07 +0200 Subject: [PATCH] Fix typeerror hon#77 --- pyhon/appliances/dw.py | 2 +- pyhon/appliances/ov.py | 2 +- pyhon/appliances/td.py | 2 +- pyhon/appliances/wd.py | 2 +- pyhon/appliances/wm.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyhon/appliances/dw.py b/pyhon/appliances/dw.py index 6e980b7..3bb1d83 100644 --- a/pyhon/appliances/dw.py +++ b/pyhon/appliances/dw.py @@ -4,7 +4,7 @@ from pyhon.appliances.base import ApplianceBase class Appliance(ApplianceBase): def attributes(self, data): data = super().attributes(data) - if data["lastConnEvent"]["category"] == "DISCONNECTED": + if data.get("lastConnEvent", {}).get("category", "") == "DISCONNECTED": data["parameters"]["machMode"] = "0" data["active"] = bool(data.get("activity")) return data diff --git a/pyhon/appliances/ov.py b/pyhon/appliances/ov.py index 5558690..31209e1 100644 --- a/pyhon/appliances/ov.py +++ b/pyhon/appliances/ov.py @@ -4,7 +4,7 @@ from pyhon.appliances.base import ApplianceBase class Appliance(ApplianceBase): def attributes(self, data): data = super().attributes(data) - if data["lastConnEvent"]["category"] == "DISCONNECTED": + if data.get("lastConnEvent", {}).get("category", "") == "DISCONNECTED": data["parameters"]["temp"] = "0" data["parameters"]["onOffStatus"] = "0" data["parameters"]["remoteCtrValid"] = "0" diff --git a/pyhon/appliances/td.py b/pyhon/appliances/td.py index ee21748..c78d58e 100644 --- a/pyhon/appliances/td.py +++ b/pyhon/appliances/td.py @@ -5,7 +5,7 @@ from pyhon.parameter.fixed import HonParameterFixed class Appliance(ApplianceBase): def attributes(self, data): data = super().attributes(data) - if data["lastConnEvent"]["category"] == "DISCONNECTED": + if data.get("lastConnEvent", {}).get("category", "") == "DISCONNECTED": data["parameters"]["machMode"] = "0" data["active"] = bool(data.get("activity")) data["pause"] = data["parameters"]["machMode"] == "3" diff --git a/pyhon/appliances/wd.py b/pyhon/appliances/wd.py index ee4ccac..073d730 100644 --- a/pyhon/appliances/wd.py +++ b/pyhon/appliances/wd.py @@ -4,7 +4,7 @@ from pyhon.appliances.base import ApplianceBase class Appliance(ApplianceBase): def attributes(self, data): data = super().attributes(data) - if data["lastConnEvent"]["category"] == "DISCONNECTED": + if data.get("lastConnEvent", {}).get("category", "") == "DISCONNECTED": data["parameters"]["machMode"] = "0" data["active"] = bool(data.get("activity")) data["pause"] = data["parameters"]["machMode"] == "3" diff --git a/pyhon/appliances/wm.py b/pyhon/appliances/wm.py index ee4ccac..073d730 100644 --- a/pyhon/appliances/wm.py +++ b/pyhon/appliances/wm.py @@ -4,7 +4,7 @@ from pyhon.appliances.base import ApplianceBase class Appliance(ApplianceBase): def attributes(self, data): data = super().attributes(data) - if data["lastConnEvent"]["category"] == "DISCONNECTED": + if data.get("lastConnEvent", {}).get("category", "") == "DISCONNECTED": data["parameters"]["machMode"] = "0" data["active"] = bool(data.get("activity")) data["pause"] = data["parameters"]["machMode"] == "3"