mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Explicitly pass in the config_entry in iometer coordinator (#138142)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
8c3dab199e
commit
15af006fbe
@ -26,7 +26,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: IOmeterConfigEntry) -> b
|
||||
except IOmeterConnectionError as err:
|
||||
raise ConfigEntryNotReady from err
|
||||
|
||||
coordinator = IOMeterCoordinator(hass, client)
|
||||
coordinator = IOMeterCoordinator(hass, entry, client)
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
entry.runtime_data = coordinator
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
|
@ -32,17 +32,23 @@ class IOMeterCoordinator(DataUpdateCoordinator[IOmeterData]):
|
||||
config_entry: IOmeterConfigEntry
|
||||
client: IOmeterClient
|
||||
|
||||
def __init__(self, hass: HomeAssistant, client: IOmeterClient) -> None:
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: IOmeterConfigEntry,
|
||||
client: IOmeterClient,
|
||||
) -> None:
|
||||
"""Initialize coordinator."""
|
||||
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
update_interval=DEFAULT_SCAN_INTERVAL,
|
||||
)
|
||||
self.client = client
|
||||
self.identifier = self.config_entry.entry_id
|
||||
self.identifier = config_entry.entry_id
|
||||
|
||||
async def _async_update_data(self) -> IOmeterData:
|
||||
"""Update data async."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user