From 0e26b4a0f7d5919044b2ba0b9a5d74950e7fb51c Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Fri, 29 Mar 2024 14:48:35 +0100 Subject: [PATCH] Fix applance connection handling --- custom_components/hon/button.py | 2 +- custom_components/hon/lock.py | 2 +- custom_components/hon/manifest.json | 4 ++-- custom_components/hon/number.py | 2 +- custom_components/hon/select.py | 2 +- custom_components/hon/switch.py | 2 +- requirements.txt | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/custom_components/hon/button.py b/custom_components/hon/button.py index f5f3d28..ce0f548 100644 --- a/custom_components/hon/button.py +++ b/custom_components/hon/button.py @@ -82,7 +82,7 @@ class HonButtonEntity(HonEntity, ButtonEntity): return ( super().available and int(self._device.get("remoteCtrValid", "1")) == 1 - and self._device.get("attributes.lastConnEvent.category") != "DISCONNECTED" + and self._device.connection ) diff --git a/custom_components/hon/lock.py b/custom_components/hon/lock.py index 510641c..63304c1 100644 --- a/custom_components/hon/lock.py +++ b/custom_components/hon/lock.py @@ -76,7 +76,7 @@ class HonLockEntity(HonEntity, LockEntity): return ( super().available and int(self._device.get("remoteCtrValid", 1)) == 1 - and self._device.get("attributes.lastConnEvent.category") != "DISCONNECTED" + and self._device.connection ) @callback diff --git a/custom_components/hon/manifest.json b/custom_components/hon/manifest.json index 49abb37..637fd88 100644 --- a/custom_components/hon/manifest.json +++ b/custom_components/hon/manifest.json @@ -9,7 +9,7 @@ "iot_class": "cloud_push", "issue_tracker": "https://github.com/Andre0512/hon/issues", "requirements": [ - "pyhOn==0.17.2" + "pyhOn==0.17.3" ], - "version": "0.14.0-beta.4" + "version": "0.14.0-beta.5" } diff --git a/custom_components/hon/number.py b/custom_components/hon/number.py index 8cf8a1e..fc6e88f 100644 --- a/custom_components/hon/number.py +++ b/custom_components/hon/number.py @@ -276,7 +276,7 @@ class HonNumberEntity(HonEntity, NumberEntity): return ( super().available and int(self._device.get("remoteCtrValid", 1)) == 1 - and self._device.get("attributes.lastConnEvent.category") != "DISCONNECTED" + and self._device.connection ) diff --git a/custom_components/hon/select.py b/custom_components/hon/select.py index 1eb620e..7bd9440 100644 --- a/custom_components/hon/select.py +++ b/custom_components/hon/select.py @@ -325,7 +325,7 @@ class HonSelectEntity(HonEntity, SelectEntity): return ( super().available and int(self._device.get("remoteCtrValid", 1)) == 1 - and self._device.get("attributes.lastConnEvent.category") != "DISCONNECTED" + and self._device.connection ) @callback diff --git a/custom_components/hon/switch.py b/custom_components/hon/switch.py index 36d283e..063e6db 100644 --- a/custom_components/hon/switch.py +++ b/custom_components/hon/switch.py @@ -507,7 +507,7 @@ class HonControlSwitchEntity(HonEntity, SwitchEntity): return ( super().available and int(self._device.get("remoteCtrValid", 1)) == 1 - and self._device.get("attributes.lastConnEvent.category") != "DISCONNECTED" + and self._device.connection ) @property diff --git a/requirements.txt b/requirements.txt index 11d498a..fb9018e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -pyhOn==0.17.2 +pyhOn==0.17.3