Check remote control only if available, fix #50

This commit is contained in:
Andre Basche 2023-05-16 20:34:05 +02:00
parent 617ea0f99a
commit fae4c4c879
4 changed files with 4 additions and 4 deletions

View file

@ -69,7 +69,7 @@ class HonButtonEntity(HonEntity, ButtonEntity):
"""Return True if entity is available.""" """Return True if entity is available."""
return ( return (
super().available super().available
and self._device.get("remoteCtrValid") == "1" and self._device.get("remoteCtrValid", "1") == "1"
and self._device.get("attributes.lastConnEvent.category") != "DISCONNECTED" and self._device.get("attributes.lastConnEvent.category") != "DISCONNECTED"
) )

View file

@ -243,7 +243,7 @@ class HonNumberEntity(HonEntity, NumberEntity):
else: else:
return ( return (
super().available super().available
and self._device.get("remoteCtrValid") == "1" and self._device.get("remoteCtrValid", "1") == "1"
and self._device.get("attributes.lastConnEvent.category") and self._device.get("attributes.lastConnEvent.category")
!= "DISCONNECTED" != "DISCONNECTED"
) )

View file

@ -207,7 +207,7 @@ class HonSelectEntity(HonEntity, SelectEntity):
else: else:
return ( return (
super().available super().available
and self._device.get("remoteCtrValid") == "1" and self._device.get("remoteCtrValid", "1") == "1"
and self._device.get("attributes.lastConnEvent.category") and self._device.get("attributes.lastConnEvent.category")
!= "DISCONNECTED" != "DISCONNECTED"
) )

View file

@ -434,7 +434,7 @@ class HonSwitchEntity(HonEntity, SwitchEntity):
else: else:
return ( return (
super().available super().available
and self._device.get("remoteCtrValid") == "1" and self._device.get("remoteCtrValid", "1") == "1"
and self._device.get("attributes.lastConnEvent.category") and self._device.get("attributes.lastConnEvent.category")
!= "DISCONNECTED" != "DISCONNECTED"
) )