Deactivate contols when remotectrl disabled, fixes #28

This commit is contained in:
Andre Basche 2023-05-07 19:12:45 +02:00
parent 74f5887bb2
commit 6935f5f07f
4 changed files with 13 additions and 18 deletions

View file

@ -379,3 +379,11 @@ class HonSwitchEntity(HonEntity, SwitchEntity):
await self.coordinator.async_refresh()
else:
await self._device.commands[self.entity_description.turn_off_key].send()
@property
def available(self) -> bool:
"""Return True if entity is available."""
if self.entity_category == EntityCategory.CONFIG:
return super().available
else:
return super().available and self._device.get("remoteCtrValid") == "1"