Fix sensor setup during dynamic addition of Miele devices (#144551)

Fix sensors when dynamic addition of devices
This commit is contained in:
Åke Strandberg 2025-05-09 20:07:23 +02:00 committed by GitHub
parent 2940cb0fa0
commit 85f1c89808
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -455,7 +455,10 @@ async def async_setup_entry(
for device_id, device in coordinator.data.devices.items():
for definition in SENSOR_TYPES:
if device.device_type in definition.types:
if (
device_id in new_devices_set
and device.device_type in definition.types
):
match definition.description.key:
case "state_status":
entity_class = MieleStatusSensor
@ -466,8 +469,7 @@ async def async_setup_entry(
case _:
entity_class = MieleSensor
if (
device_id in new_devices_set
and definition.description.device_class
definition.description.device_class
== SensorDeviceClass.TEMPERATURE
and definition.description.value_fn(device)
== DISABLED_TEMPERATURE / 100