Add push updates support to WiZ (#65987)

This commit is contained in:
J. Nick Koston 2022-02-07 09:46:00 -06:00 committed by GitHub
parent 3c5a667d97
commit 9c82dcdee7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 5 deletions

View File

@ -81,6 +81,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
hass, _LOGGER, cooldown=REQUEST_REFRESH_DELAY, immediate=False
),
)
await bulb.start_push(lambda _: coordinator.async_set_updated_data(None))
await coordinator.async_config_entry_first_refresh()
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = WizData(
@ -93,5 +95,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
hass.data[DOMAIN].pop(entry.entry_id)
data: WizData = hass.data[DOMAIN].pop(entry.entry_id)
await data.bulb.async_close()
return unload_ok

View File

@ -8,7 +8,7 @@
],
"dependencies": ["network"],
"documentation": "https://www.home-assistant.io/integrations/wiz",
"requirements": ["pywizlight==0.5"],
"iot_class": "local_polling",
"requirements": ["pywizlight==0.5.1"],
"iot_class": "local_push",
"codeowners": ["@sbidy"]
}

View File

@ -2051,7 +2051,7 @@ pywemo==0.7.0
pywilight==0.0.70
# homeassistant.components.wiz
pywizlight==0.5
pywizlight==0.5.1
# homeassistant.components.xeoma
pyxeoma==1.4.1

View File

@ -1276,7 +1276,7 @@ pywemo==0.7.0
pywilight==0.0.70
# homeassistant.components.wiz
pywizlight==0.5
pywizlight==0.5.1
# homeassistant.components.zerproc
pyzerproc==0.4.8