diff --git a/custom_components/hon/button.py b/custom_components/hon/button.py index 1d4e85f..ce8f9d4 100644 --- a/custom_components/hon/button.py +++ b/custom_components/hon/button.py @@ -67,7 +67,11 @@ class HonButtonEntity(HonEntity, ButtonEntity): @property def available(self) -> bool: """Return True if entity is available.""" - return super().available and self._device.get("remoteCtrValid") == "1" + return ( + super().available + and self._device.get("remoteCtrValid") == "1" + and self._device.get("attributes.lastConnEvent.category") != "DISCONNECTED" + ) class HonFeatureRequestButton(HonEntity, ButtonEntity): diff --git a/custom_components/hon/switch.py b/custom_components/hon/switch.py index 2240491..af554cc 100644 --- a/custom_components/hon/switch.py +++ b/custom_components/hon/switch.py @@ -410,4 +410,9 @@ class HonSwitchEntity(HonEntity, SwitchEntity): if self.entity_category == EntityCategory.CONFIG: return super().available else: - return super().available and self._device.get("remoteCtrValid") == "1" + return ( + super().available + and self._device.get("remoteCtrValid") == "1" + and self._device.get("attributes.lastConnEvent.category") + != "DISCONNECTED" + )