Show controls always unavailable when diconnected #43
This commit is contained in:
		| @ -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): | ||||
|  | ||||
| @ -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" | ||||
|             ) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user