Explicitly pass in the config_entry in wemo coordinator (#137867)

explicitly pass in the config_entry in coordinator
This commit is contained in:
Michael 2025-02-09 14:04:34 +01:00 committed by GitHub
parent 0ecff272f2
commit f464aee33a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -88,13 +88,17 @@ class Options:
class DeviceCoordinator(DataUpdateCoordinator[None]):
"""Home Assistant wrapper for a pyWeMo device."""
config_entry: ConfigEntry
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."""
super().__init__(
hass,
_LOGGER,
config_entry=config_entry,
name=wemo.name,
update_interval=timedelta(seconds=30),
)
@ -285,7 +289,7 @@ async def async_register_device(
hass: HomeAssistant, config_entry: ConfigEntry, wemo: WeMoDevice
) -> DeviceCoordinator:
"""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()
if not device.last_update_success and device.last_exception:
raise device.last_exception