Check remote control only if available, fix #50
This commit is contained in:
parent
617ea0f99a
commit
fae4c4c879
@ -69,7 +69,7 @@ class HonButtonEntity(HonEntity, ButtonEntity):
|
||||
"""Return True if entity is available."""
|
||||
return (
|
||||
super().available
|
||||
and self._device.get("remoteCtrValid") == "1"
|
||||
and self._device.get("remoteCtrValid", "1") == "1"
|
||||
and self._device.get("attributes.lastConnEvent.category") != "DISCONNECTED"
|
||||
)
|
||||
|
||||
|
@ -243,7 +243,7 @@ class HonNumberEntity(HonEntity, NumberEntity):
|
||||
else:
|
||||
return (
|
||||
super().available
|
||||
and self._device.get("remoteCtrValid") == "1"
|
||||
and self._device.get("remoteCtrValid", "1") == "1"
|
||||
and self._device.get("attributes.lastConnEvent.category")
|
||||
!= "DISCONNECTED"
|
||||
)
|
||||
|
@ -207,7 +207,7 @@ class HonSelectEntity(HonEntity, SelectEntity):
|
||||
else:
|
||||
return (
|
||||
super().available
|
||||
and self._device.get("remoteCtrValid") == "1"
|
||||
and self._device.get("remoteCtrValid", "1") == "1"
|
||||
and self._device.get("attributes.lastConnEvent.category")
|
||||
!= "DISCONNECTED"
|
||||
)
|
||||
|
@ -434,7 +434,7 @@ class HonSwitchEntity(HonEntity, SwitchEntity):
|
||||
else:
|
||||
return (
|
||||
super().available
|
||||
and self._device.get("remoteCtrValid") == "1"
|
||||
and self._device.get("remoteCtrValid", "1") == "1"
|
||||
and self._device.get("attributes.lastConnEvent.category")
|
||||
!= "DISCONNECTED"
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user