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 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() await coordinator.async_config_entry_first_refresh()
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = WizData( 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: async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry.""" """Unload a config entry."""
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS): 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 return unload_ok

View File

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

View File

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

View File

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