diff --git a/custom_components/luxtronik/sensor.py b/custom_components/luxtronik/sensor.py index d484320..f441376 100644 --- a/custom_components/luxtronik/sensor.py +++ b/custom_components/luxtronik/sensor.py @@ -869,6 +869,9 @@ def __init__( self._attr_extra_state_attributes = { ATTR_EXTRA_STATE_ATTRIBUTE_LUXTRONIK_KEY: sensor_key } self._extra_attributes = extra_attributes + def disable_by_default(self): + self._attr_entity_registry_enabled_default = False + @property def icon(self): # -> str | None: """Return the icon to be used for this entity.""" @@ -1186,8 +1189,9 @@ def _schedule_immediate_update(self): self.async_schedule_update_ha_state(True) def add_sensor_if_active(luxtronik, entities, check_key: str, sensor: LuxtronikSensor): - if luxtronik.get_value(check_key) > 0: - entities += [sensor] + if luxtronik.get_value(check_key) <= 0: + sensor.disable_by_default() + entities += [sensor] def add_sensor_if_min_minor_version(luxtronik, entities, min_minor: int, sensor: LuxtronikSensor): if luxtronik.firmware_version_minor >= min_minor: