fix(ecowitt): Connect Ecowitt bridge to sensor platform earlier
parent
b578142099
commit
4e597c1fd5
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue