INNER CODE UNIT · Python

async_setup_entry

3dg1luk43/ha_washdata · custom_components/ha_washdata/__init__.py:651

async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
    """Set up WashData from a config entry."""
    _log = DeviceLoggerAdapter(_LOGGER, entry.title)
    hass.data.setdefault(DOMAIN, {})

    # Panel / card / WebSocket API first: they belong to the HA instance, not to
    # this appliance, so they must not depend on this entry getting through
    # (#425).  See _async_setup_shared.
    await _async_setup_shared(hass, _log)

    # Debris from an earlier setup that failed part-way.  HA does NOT call
    # async_unload_entry for an entry that never reached LOADED, so the manager
    # this function stores before the failure point is still here - and before
    # #425 we answered that by logging "already set up" and returning True,
    # which told HA the entry was loaded while everything after the failure
    # point (device link, half the services, the update listener) had never
    # run.  Every later reload repeated the lie, so the only way out was to
    # delete and re-add the appliance.  Throw the leftover away and set up for

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…