mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +00:00
Use OptionsFlowWithReload in ezviz (#149167)
This commit is contained in:
parent
05566e1621
commit
be25a7bc70
@ -94,8 +94,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: EzvizConfigEntry) -> boo
|
|||||||
|
|
||||||
entry.runtime_data = coordinator
|
entry.runtime_data = coordinator
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
|
||||||
|
|
||||||
# Check EZVIZ cloud account entity is present, reload cloud account entities for camera entity change to take effect.
|
# Check EZVIZ cloud account entity is present, reload cloud account entities for camera entity change to take effect.
|
||||||
# Cameras are accessed via local RTSP stream with unique credentials per camera.
|
# Cameras are accessed via local RTSP stream with unique credentials per camera.
|
||||||
# Separate camera entities allow for credential changes per camera.
|
# Separate camera entities allow for credential changes per camera.
|
||||||
@ -120,8 +118,3 @@ async def async_unload_entry(hass: HomeAssistant, entry: EzvizConfigEntry) -> bo
|
|||||||
return await hass.config_entries.async_unload_platforms(
|
return await hass.config_entries.async_unload_platforms(
|
||||||
entry, PLATFORMS_BY_TYPE[sensor_type]
|
entry, PLATFORMS_BY_TYPE[sensor_type]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def _async_update_listener(hass: HomeAssistant, entry: EzvizConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -17,7 +17,11 @@ from pyezvizapi.exceptions import (
|
|||||||
from pyezvizapi.test_cam_rtsp import TestRTSPAuth
|
from pyezvizapi.test_cam_rtsp import TestRTSPAuth
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
|
from homeassistant.config_entries import (
|
||||||
|
ConfigFlow,
|
||||||
|
ConfigFlowResult,
|
||||||
|
OptionsFlowWithReload,
|
||||||
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_CUSTOMIZE,
|
CONF_CUSTOMIZE,
|
||||||
CONF_IP_ADDRESS,
|
CONF_IP_ADDRESS,
|
||||||
@ -386,7 +390,7 @@ class EzvizConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class EzvizOptionsFlowHandler(OptionsFlow):
|
class EzvizOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle EZVIZ client options."""
|
"""Handle EZVIZ client options."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user