mirror of
https://github.com/Andre0512/hon.git
synced 2024-12-22 18:55:31 +00:00
Show controls always unavailable when diconnected #43
This commit is contained in:
parent
593d3912af
commit
17d4d14ead
|
@ -67,7 +67,11 @@ class HonButtonEntity(HonEntity, ButtonEntity):
|
||||||
@property
|
@property
|
||||||
def available(self) -> bool:
|
def available(self) -> bool:
|
||||||
"""Return True if entity is available."""
|
"""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):
|
class HonFeatureRequestButton(HonEntity, ButtonEntity):
|
||||||
|
|
|
@ -410,4 +410,9 @@ class HonSwitchEntity(HonEntity, SwitchEntity):
|
||||||
if self.entity_category == EntityCategory.CONFIG:
|
if self.entity_category == EntityCategory.CONFIG:
|
||||||
return super().available
|
return super().available
|
||||||
else:
|
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"
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in a new issue