mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Explicitly pass in the config_entry in wemo coordinator (#137867)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
0ecff272f2
commit
f464aee33a
@ -88,13 +88,17 @@ class Options:
|
|||||||
class DeviceCoordinator(DataUpdateCoordinator[None]):
|
class DeviceCoordinator(DataUpdateCoordinator[None]):
|
||||||
"""Home Assistant wrapper for a pyWeMo device."""
|
"""Home Assistant wrapper for a pyWeMo device."""
|
||||||
|
|
||||||
|
config_entry: ConfigEntry
|
||||||
options: Options | None = None
|
options: Options | None = None
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, wemo: WeMoDevice) -> None:
|
def __init__(
|
||||||
|
self, hass: HomeAssistant, config_entry: ConfigEntry, wemo: WeMoDevice
|
||||||
|
) -> None:
|
||||||
"""Initialize DeviceCoordinator."""
|
"""Initialize DeviceCoordinator."""
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
name=wemo.name,
|
name=wemo.name,
|
||||||
update_interval=timedelta(seconds=30),
|
update_interval=timedelta(seconds=30),
|
||||||
)
|
)
|
||||||
@ -285,7 +289,7 @@ async def async_register_device(
|
|||||||
hass: HomeAssistant, config_entry: ConfigEntry, wemo: WeMoDevice
|
hass: HomeAssistant, config_entry: ConfigEntry, wemo: WeMoDevice
|
||||||
) -> DeviceCoordinator:
|
) -> DeviceCoordinator:
|
||||||
"""Register a device with home assistant and enable pywemo event callbacks."""
|
"""Register a device with home assistant and enable pywemo event callbacks."""
|
||||||
device = DeviceCoordinator(hass, wemo)
|
device = DeviceCoordinator(hass, config_entry, wemo)
|
||||||
await device.async_refresh()
|
await device.async_refresh()
|
||||||
if not device.last_update_success and device.last_exception:
|
if not device.last_update_success and device.last_exception:
|
||||||
raise device.last_exception
|
raise device.last_exception
|
||||||
|
Loading…
x
Reference in New Issue
Block a user