mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +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:
|
except IOmeterConnectionError as err:
|
||||||
raise ConfigEntryNotReady from err
|
raise ConfigEntryNotReady from err
|
||||||
|
|
||||||
coordinator = IOMeterCoordinator(hass, client)
|
coordinator = IOMeterCoordinator(hass, entry, client)
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
entry.runtime_data = coordinator
|
entry.runtime_data = coordinator
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
|
@ -32,17 +32,23 @@ class IOMeterCoordinator(DataUpdateCoordinator[IOmeterData]):
|
|||||||
config_entry: IOmeterConfigEntry
|
config_entry: IOmeterConfigEntry
|
||||||
client: IOmeterClient
|
client: IOmeterClient
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, client: IOmeterClient) -> None:
|
def __init__(
|
||||||
|
self,
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config_entry: IOmeterConfigEntry,
|
||||||
|
client: IOmeterClient,
|
||||||
|
) -> None:
|
||||||
"""Initialize coordinator."""
|
"""Initialize coordinator."""
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
name=DOMAIN,
|
name=DOMAIN,
|
||||||
update_interval=DEFAULT_SCAN_INTERVAL,
|
update_interval=DEFAULT_SCAN_INTERVAL,
|
||||||
)
|
)
|
||||||
self.client = client
|
self.client = client
|
||||||
self.identifier = self.config_entry.entry_id
|
self.identifier = config_entry.entry_id
|
||||||
|
|
||||||
async def _async_update_data(self) -> IOmeterData:
|
async def _async_update_data(self) -> IOmeterData:
|
||||||
"""Update data async."""
|
"""Update data async."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user