fix(ecowitt): Connect Ecowitt bridge to sensor platform earlier

SchiZzA 2026-06-21 11:28:24 +02:00
parent e3d712bd54
commit b777296b52
No known key found for this signature in database
1 changed files with 4 additions and 4 deletions

View File

@ -103,6 +103,10 @@ async def async_setup_entry(
runtime.add_sensor_entities = async_add_entities
runtime.sensor_descriptions = {desc.key: desc for desc in sensor_types}
# Connect Ecowitt bridge to sensor platform so it can dynamically add
# native Ecowitt entities (sensors without internal SWS mapping).
coordinator.ecowitt_bridge.set_add_entities(async_add_entities)
sensors_to_load = checked_or(config_entry.options.get(SENSORS_TO_LOAD), list[str], [])
if not sensors_to_load:
return
@ -114,10 +118,6 @@ async def async_setup_entry(
]
async_add_entities(entities)
# Connect Ecowitt bridge to sensor platform so it can dynamically add
# native Ecowitt entities (sensors without internal SWS mapping).
coordinator.ecowitt_bridge.set_add_entities(async_add_entities)
def add_new_sensors(hass: HomeAssistant, config_entry: SWSConfigEntry, keys: list[str]) -> None:
"""Dynamically add newly discovered sensors without reloading the entry.