From 5e32dd76c088c34e2795e3ba44c87d4477e2b811 Mon Sep 17 00:00:00 2001 From: drudgebg Date: Tue, 21 Mar 2023 08:39:20 +0200 Subject: [PATCH] Create td.py Need to work with Tumble Dryers. Tested and work with Tumble Dryer haier HD80-A3959. --- pyhon/appliances/td.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 pyhon/appliances/td.py diff --git a/pyhon/appliances/td.py b/pyhon/appliances/td.py new file mode 100644 index 0000000..8664484 --- /dev/null +++ b/pyhon/appliances/td.py @@ -0,0 +1,10 @@ +class Appliance: + def __init__(self, data): + self._data = data + + def get(self): + if self._data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED": + self._data["attributes"]["parameters"]["machMode"] = "0" + self._data["active"] = bool(self._data.get("activity")) + self._data["pause"] = self._data["attributes"]["parameters"]["machMode"] == "3" + return self._data