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

@ -209,7 +209,6 @@ I moved the api related stuff into the package [pyhOn](https://github.com/Andre0
| Pan Status | `pot-mix` | `binary_sensor` | `panStatus` |
| Power | `lightning-bolt` | `sensor` | `power` |
| Remaining Time | `timer` | `sensor` | `remainingTimeMM` |
| Remote Control | `remote` | `binary_sensor` | `attributes.parameters.remoteCtrValid` |
| Temperature | `thermometer` | `sensor` | `temp` |
### Oven
@ -231,7 +230,6 @@ I moved the api related stuff into the package [pyhOn](https://github.com/Andre0
| Connection | `wifi` | `binary_sensor` | `attributes.lastConnEvent.category` |
| On | `power-cycle` | `binary_sensor` | `attributes.parameters.onOffStatus` |
| Remaining Time | `timer` | `sensor` | `remainingTimeMM` |
| Remote Control | `remote` | `binary_sensor` | `attributes.parameters.remoteCtrValid` |
| Start Time | `clock-start` | `sensor` | `delayTime` |
| Temperature | `thermometer` | `sensor` | `temp` |
| Temperature Selected | `thermometer` | `sensor` | `tempSel` |

View file

@ -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",

View file

@ -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"

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"