mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Explicitly pass in the config_entry in smarty coordinator (#137944)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
13dbeed5c2
commit
b512838d1e
@ -89,7 +89,7 @@ async def _async_import(hass: HomeAssistant, config: ConfigType) -> None:
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: SmartyConfigEntry) -> bool:
|
||||
"""Set up the Smarty environment from a config entry."""
|
||||
|
||||
coordinator = SmartyCoordinator(hass)
|
||||
coordinator = SmartyCoordinator(hass, entry)
|
||||
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
|
||||
|
@ -22,15 +22,16 @@ class SmartyCoordinator(DataUpdateCoordinator[None]):
|
||||
software_version: str
|
||||
configuration_version: str
|
||||
|
||||
def __init__(self, hass: HomeAssistant) -> None:
|
||||
def __init__(self, hass: HomeAssistant, config_entry: SmartyConfigEntry) -> None:
|
||||
"""Initialize."""
|
||||
super().__init__(
|
||||
hass,
|
||||
logger=_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name="Smarty",
|
||||
update_interval=timedelta(seconds=30),
|
||||
)
|
||||
self.client = Smarty(host=self.config_entry.data[CONF_HOST])
|
||||
self.client = Smarty(host=config_entry.data[CONF_HOST])
|
||||
|
||||
async def _async_setup(self) -> None:
|
||||
if not await self.hass.async_add_executor_job(self.client.update):
|
||||
|
Loading…
x
Reference in New Issue
Block a user