Deactivate contols when remotectrl disabled, fixes #28
This commit is contained in:
@ -99,14 +99,6 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = {
|
||||
icon="mdi:wifi",
|
||||
translation_key="connection",
|
||||
),
|
||||
HonBinarySensorEntityDescription(
|
||||
key="attributes.parameters.remoteCtrValid",
|
||||
name="Remote Control",
|
||||
device_class=BinarySensorDeviceClass.CONNECTIVITY,
|
||||
on_value="1",
|
||||
icon="mdi:remote",
|
||||
translation_key="remote_control",
|
||||
),
|
||||
HonBinarySensorEntityDescription(
|
||||
key="attributes.parameters.onOffStatus",
|
||||
name="On",
|
||||
@ -125,14 +117,6 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = {
|
||||
icon="mdi:wifi",
|
||||
translation_key="connection",
|
||||
),
|
||||
HonBinarySensorEntityDescription(
|
||||
key="attributes.parameters.remoteCtrValid",
|
||||
name="Remote Control",
|
||||
device_class=BinarySensorDeviceClass.CONNECTIVITY,
|
||||
on_value="1",
|
||||
icon="mdi:remote",
|
||||
translation_key="remote_control",
|
||||
),
|
||||
HonBinarySensorEntityDescription(
|
||||
key="attributes.parameters.onOffStatus",
|
||||
name="On",
|
||||
|
@ -80,3 +80,8 @@ class HonFeatureRequestButton(HonEntity, ButtonEntity):
|
||||
pyhon_version = pkg_resources.get_distribution("pyhon").version
|
||||
info = f"Device Info:\n{self._device.diagnose}pyhOnVersion: {pyhon_version}"
|
||||
_LOGGER.error(info)
|
||||
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return True if entity is available."""
|
||||
return super().available and self._device.get("remoteCtrValid") == "1"
|
||||
|
@ -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"
|
||||
|
Reference in New Issue
Block a user