mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Don't rely on deCONZ gateway object in config options flow (#71079)
This commit is contained in:
parent
e1f4b17971
commit
865c75b631
@ -31,12 +31,15 @@ from .const import (
|
|||||||
CONF_ALLOW_CLIP_SENSOR,
|
CONF_ALLOW_CLIP_SENSOR,
|
||||||
CONF_ALLOW_DECONZ_GROUPS,
|
CONF_ALLOW_DECONZ_GROUPS,
|
||||||
CONF_ALLOW_NEW_DEVICES,
|
CONF_ALLOW_NEW_DEVICES,
|
||||||
|
DEFAULT_ALLOW_CLIP_SENSOR,
|
||||||
|
DEFAULT_ALLOW_DECONZ_GROUPS,
|
||||||
|
DEFAULT_ALLOW_NEW_DEVICES,
|
||||||
DEFAULT_PORT,
|
DEFAULT_PORT,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
HASSIO_CONFIGURATION_URL,
|
HASSIO_CONFIGURATION_URL,
|
||||||
LOGGER,
|
LOGGER,
|
||||||
)
|
)
|
||||||
from .gateway import DeconzGateway, get_gateway_from_config_entry
|
from .gateway import DeconzGateway
|
||||||
|
|
||||||
DECONZ_MANUFACTURERURL = "http://www.dresden-elektronik.de"
|
DECONZ_MANUFACTURERURL = "http://www.dresden-elektronik.de"
|
||||||
CONF_SERIAL = "serial"
|
CONF_SERIAL = "serial"
|
||||||
@ -298,7 +301,6 @@ class DeconzOptionsFlowHandler(OptionsFlow):
|
|||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> FlowResult:
|
) -> FlowResult:
|
||||||
"""Manage the deCONZ options."""
|
"""Manage the deCONZ options."""
|
||||||
self.gateway = get_gateway_from_config_entry(self.hass, self.config_entry)
|
|
||||||
return await self.async_step_deconz_devices()
|
return await self.async_step_deconz_devices()
|
||||||
|
|
||||||
async def async_step_deconz_devices(
|
async def async_step_deconz_devices(
|
||||||
@ -309,22 +311,20 @@ class DeconzOptionsFlowHandler(OptionsFlow):
|
|||||||
self.options.update(user_input)
|
self.options.update(user_input)
|
||||||
return self.async_create_entry(title="", data=self.options)
|
return self.async_create_entry(title="", data=self.options)
|
||||||
|
|
||||||
|
schema_options = {}
|
||||||
|
for option, default in (
|
||||||
|
(CONF_ALLOW_CLIP_SENSOR, DEFAULT_ALLOW_CLIP_SENSOR),
|
||||||
|
(CONF_ALLOW_DECONZ_GROUPS, DEFAULT_ALLOW_DECONZ_GROUPS),
|
||||||
|
(CONF_ALLOW_NEW_DEVICES, DEFAULT_ALLOW_NEW_DEVICES),
|
||||||
|
):
|
||||||
|
schema_options[
|
||||||
|
vol.Optional(
|
||||||
|
option,
|
||||||
|
default=self.config_entry.options.get(option, default),
|
||||||
|
)
|
||||||
|
] = bool
|
||||||
|
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="deconz_devices",
|
step_id="deconz_devices",
|
||||||
data_schema=vol.Schema(
|
data_schema=vol.Schema(schema_options),
|
||||||
{
|
|
||||||
vol.Optional(
|
|
||||||
CONF_ALLOW_CLIP_SENSOR,
|
|
||||||
default=self.gateway.option_allow_clip_sensor,
|
|
||||||
): bool,
|
|
||||||
vol.Optional(
|
|
||||||
CONF_ALLOW_DECONZ_GROUPS,
|
|
||||||
default=self.gateway.option_allow_deconz_groups,
|
|
||||||
): bool,
|
|
||||||
vol.Optional(
|
|
||||||
CONF_ALLOW_NEW_DEVICES,
|
|
||||||
default=self.gateway.option_allow_new_devices,
|
|
||||||
): bool,
|
|
||||||
}
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user