Explicitly pass in the config_entry in Tankerkoenig coordinator init (#136780)

This commit is contained in:
Michael 2025-01-29 01:18:21 +01:00 committed by GitHub
parent ba2d1e698d
commit 01b278c547
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 8 deletions

View File

@ -17,11 +17,7 @@ async def async_setup_entry(
"""Set a tankerkoenig configuration entry up.""" """Set a tankerkoenig configuration entry up."""
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})
coordinator = TankerkoenigDataUpdateCoordinator( coordinator = TankerkoenigDataUpdateCoordinator(hass, entry, DEFAULT_SCAN_INTERVAL)
hass,
name=entry.unique_id or DOMAIN,
update_interval=DEFAULT_SCAN_INTERVAL,
)
await coordinator.async_setup() await coordinator.async_setup()
await coordinator.async_config_entry_first_refresh() await coordinator.async_config_entry_first_refresh()

View File

@ -24,7 +24,7 @@ from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from .const import CONF_FUEL_TYPES, CONF_STATIONS from .const import CONF_FUEL_TYPES, CONF_STATIONS, DOMAIN
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -39,7 +39,7 @@ class TankerkoenigDataUpdateCoordinator(DataUpdateCoordinator[dict[str, PriceInf
def __init__( def __init__(
self, self,
hass: HomeAssistant, hass: HomeAssistant,
name: str, config_entry: TankerkoenigConfigEntry,
update_interval: int, update_interval: int,
) -> None: ) -> None:
"""Initialize the data object.""" """Initialize the data object."""
@ -47,7 +47,8 @@ class TankerkoenigDataUpdateCoordinator(DataUpdateCoordinator[dict[str, PriceInf
super().__init__( super().__init__(
hass=hass, hass=hass,
logger=_LOGGER, logger=_LOGGER,
name=name, config_entry=config_entry,
name=config_entry.unique_id or DOMAIN,
update_interval=timedelta(minutes=update_interval), update_interval=timedelta(minutes=update_interval),
) )