From e5eae22ad8b86bbb08d655726bd05951484ca934 Mon Sep 17 00:00:00 2001 From: Guido Schmitz Date: Sun, 18 Oct 2020 21:07:24 +0200 Subject: [PATCH] Disable less popular entities in devolo Home Control (#41945) --- .../components/devolo_home_control/binary_sensor.py | 3 +++ .../components/devolo_home_control/devolo_device.py | 6 ++++++ homeassistant/components/devolo_home_control/sensor.py | 3 +++ 3 files changed, 12 insertions(+) diff --git a/homeassistant/components/devolo_home_control/binary_sensor.py b/homeassistant/components/devolo_home_control/binary_sensor.py index b48f19b75b4..1d581d2c0fb 100644 --- a/homeassistant/components/devolo_home_control/binary_sensor.py +++ b/homeassistant/components/devolo_home_control/binary_sensor.py @@ -82,6 +82,9 @@ class DevoloBinaryDeviceEntity(DevoloDeviceEntity, BinarySensorEntity): self._value = self._binary_sensor_property.state + if element_uid.startswith("devolo.WarningBinaryFI:"): + self._enabled_default = False + @property def is_on(self): """Return the state.""" diff --git a/homeassistant/components/devolo_home_control/devolo_device.py b/homeassistant/components/devolo_home_control/devolo_device.py index 48f9b59af4a..d0be9543bf4 100644 --- a/homeassistant/components/devolo_home_control/devolo_device.py +++ b/homeassistant/components/devolo_home_control/devolo_device.py @@ -21,6 +21,7 @@ class DevoloDeviceEntity(Entity): self._device_class = None self._value = None self._unit = None + self._enabled_default = True # This is not doing I/O. It fetches an internal state of the API self._available = device_instance.is_online() @@ -60,6 +61,11 @@ class DevoloDeviceEntity(Entity): "model": self._model, } + @property + def entity_registry_enabled_default(self) -> bool: + """Return if the entity should be enabled when first added to the entity registry.""" + return self._enabled_default + @property def should_poll(self): """Return the polling state.""" diff --git a/homeassistant/components/devolo_home_control/sensor.py b/homeassistant/components/devolo_home_control/sensor.py index c76d0c30e8e..c5ad9feb88a 100644 --- a/homeassistant/components/devolo_home_control/sensor.py +++ b/homeassistant/components/devolo_home_control/sensor.py @@ -110,6 +110,9 @@ class DevoloGenericMultiLevelDeviceEntity(DevoloMultiLevelDeviceEntity): if self._device_class is None: self._name += f" {self._multi_level_sensor_property.sensor_type}" + if element_uid.startswith("devolo.VoltageMultiLevelSensor:"): + self._enabled_default = False + class DevoloBatteryEntity(DevoloMultiLevelDeviceEntity): """Representation of a battery entity within devolo Home Control."""