2018-03-30 05:15:40 +02:00
|
|
|
"""Config flow to configure Philips Hue."""
|
2021-03-18 09:25:40 +01:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2018-03-30 05:15:40 +02:00
|
|
|
import asyncio
|
2021-11-16 20:59:17 +01:00
|
|
|
import logging
|
2019-12-19 18:28:03 +01:00
|
|
|
from urllib.parse import urlparse
|
2018-03-30 05:15:40 +02:00
|
|
|
|
2021-11-16 20:59:17 +01:00
|
|
|
from aiohue import LinkButtonNotPressed, create_app_key
|
|
|
|
from aiohue.discovery import DiscoveredHueBridge, discover_bridge, discover_nupnp
|
|
|
|
from aiohue.util import normalize_bridge_id
|
2018-03-30 05:15:40 +02:00
|
|
|
import async_timeout
|
2021-11-16 20:59:17 +01:00
|
|
|
import slugify as unicode_slug
|
2018-03-30 05:15:40 +02:00
|
|
|
import voluptuous as vol
|
|
|
|
|
2021-12-07 21:50:34 +01:00
|
|
|
from homeassistant import config_entries
|
2021-10-31 16:13:26 +01:00
|
|
|
from homeassistant.components import ssdp, zeroconf
|
2021-11-16 20:59:17 +01:00
|
|
|
from homeassistant.const import CONF_API_KEY, CONF_HOST
|
2020-07-02 14:12:24 +02:00
|
|
|
from homeassistant.core import callback
|
2021-04-29 13:40:51 +02:00
|
|
|
from homeassistant.data_entry_flow import FlowResult
|
2021-12-31 05:46:52 +01:00
|
|
|
from homeassistant.helpers import aiohttp_client, device_registry
|
|
|
|
import homeassistant.helpers.config_validation as cv
|
2021-11-29 17:10:07 +01:00
|
|
|
from homeassistant.helpers.typing import ConfigType
|
2018-03-30 05:15:40 +02:00
|
|
|
|
2021-03-30 06:02:56 +02:00
|
|
|
from .const import (
|
2020-02-11 17:50:07 +01:00
|
|
|
CONF_ALLOW_HUE_GROUPS,
|
2020-07-02 14:12:24 +02:00
|
|
|
CONF_ALLOW_UNREACHABLE,
|
2021-11-16 20:59:17 +01:00
|
|
|
CONF_API_VERSION,
|
2021-12-31 05:46:52 +01:00
|
|
|
CONF_IGNORE_AVAILABILITY,
|
2021-02-26 06:58:35 +01:00
|
|
|
DEFAULT_ALLOW_HUE_GROUPS,
|
|
|
|
DEFAULT_ALLOW_UNREACHABLE,
|
2020-02-11 17:50:07 +01:00
|
|
|
DOMAIN,
|
|
|
|
)
|
2021-11-16 20:59:17 +01:00
|
|
|
from .errors import CannotConnect
|
|
|
|
|
|
|
|
LOGGER = logging.getLogger(__name__)
|
2018-03-30 05:15:40 +02:00
|
|
|
|
2021-03-10 19:21:51 +01:00
|
|
|
HUE_MANUFACTURERURL = ("http://www.philips.com", "http://www.philips-hue.com")
|
2020-01-05 13:09:17 +01:00
|
|
|
HUE_IGNORED_BRIDGE_NAMES = ["Home Assistant Bridge", "Espalexa"]
|
2020-07-02 14:12:24 +02:00
|
|
|
HUE_MANUAL_BRIDGE_ID = "manual"
|
2019-06-03 18:26:01 +02:00
|
|
|
|
2018-03-30 05:15:40 +02:00
|
|
|
|
2019-08-20 19:46:51 +02:00
|
|
|
class HueFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
2018-03-30 05:15:40 +02:00
|
|
|
"""Handle a Hue config flow."""
|
|
|
|
|
|
|
|
VERSION = 1
|
|
|
|
|
2020-07-02 14:12:24 +02:00
|
|
|
@staticmethod
|
|
|
|
@callback
|
2021-11-16 20:59:17 +01:00
|
|
|
def async_get_options_flow(
|
|
|
|
config_entry: config_entries.ConfigEntry,
|
2021-12-31 05:46:52 +01:00
|
|
|
) -> HueV1OptionsFlowHandler | HueV2OptionsFlowHandler:
|
2020-07-02 14:12:24 +02:00
|
|
|
"""Get the options flow for this handler."""
|
2021-12-31 05:46:52 +01:00
|
|
|
if config_entry.data.get(CONF_API_VERSION, 1) == 1:
|
|
|
|
return HueV1OptionsFlowHandler(config_entry)
|
|
|
|
return HueV2OptionsFlowHandler(config_entry)
|
2019-10-07 17:17:39 +02:00
|
|
|
|
2021-11-16 20:59:17 +01:00
|
|
|
def __init__(self) -> None:
|
2018-03-30 05:15:40 +02:00
|
|
|
"""Initialize the Hue flow."""
|
2021-11-16 20:59:17 +01:00
|
|
|
self.bridge: DiscoveredHueBridge | None = None
|
|
|
|
self.discovered_bridges: dict[str, DiscoveredHueBridge] | None = None
|
2018-03-30 05:15:40 +02:00
|
|
|
|
2021-11-16 20:59:17 +01:00
|
|
|
async def async_step_user(self, user_input: ConfigType | None = None) -> FlowResult:
|
2018-08-09 13:24:14 +02:00
|
|
|
"""Handle a flow initialized by the user."""
|
2019-12-16 19:45:09 +01:00
|
|
|
# This is for backwards compatibility.
|
2018-08-09 13:24:14 +02:00
|
|
|
return await self.async_step_init(user_input)
|
|
|
|
|
2021-11-16 20:59:17 +01:00
|
|
|
async def _get_bridge(
|
|
|
|
self, host: str, bridge_id: str | None = None
|
|
|
|
) -> DiscoveredHueBridge:
|
|
|
|
"""Return a DiscoveredHueBridge object."""
|
|
|
|
bridge = await discover_bridge(
|
|
|
|
host, websession=aiohttp_client.async_get_clientsession(self.hass)
|
|
|
|
)
|
2019-12-16 19:45:09 +01:00
|
|
|
if bridge_id is not None:
|
|
|
|
bridge_id = normalize_bridge_id(bridge_id)
|
2021-11-16 20:59:17 +01:00
|
|
|
assert bridge_id == bridge.id
|
|
|
|
return bridge
|
2019-12-16 19:45:09 +01:00
|
|
|
|
2021-11-16 20:59:17 +01:00
|
|
|
async def async_step_init(self, user_input: ConfigType | None = None) -> FlowResult:
|
2018-03-30 05:15:40 +02:00
|
|
|
"""Handle a flow start."""
|
2020-07-02 14:12:24 +02:00
|
|
|
# Check if user chooses manual entry
|
|
|
|
if user_input is not None and user_input["id"] == HUE_MANUAL_BRIDGE_ID:
|
|
|
|
return await self.async_step_manual()
|
|
|
|
|
2019-12-16 19:45:09 +01:00
|
|
|
if (
|
|
|
|
user_input is not None
|
|
|
|
and self.discovered_bridges is not None
|
|
|
|
and user_input["id"] in self.discovered_bridges
|
|
|
|
):
|
|
|
|
self.bridge = self.discovered_bridges[user_input["id"]]
|
|
|
|
await self.async_set_unique_id(self.bridge.id, raise_on_progress=False)
|
2020-07-02 14:12:24 +02:00
|
|
|
return await self.async_step_link()
|
2018-03-30 05:15:40 +02:00
|
|
|
|
2020-07-02 14:12:24 +02:00
|
|
|
# Find / discover bridges
|
2018-03-30 05:15:40 +02:00
|
|
|
try:
|
2021-11-04 16:07:50 +01:00
|
|
|
async with async_timeout.timeout(5):
|
2019-12-16 19:45:09 +01:00
|
|
|
bridges = await discover_nupnp(
|
|
|
|
websession=aiohttp_client.async_get_clientsession(self.hass)
|
|
|
|
)
|
2018-03-30 05:15:40 +02:00
|
|
|
except asyncio.TimeoutError:
|
2019-07-31 21:25:30 +02:00
|
|
|
return self.async_abort(reason="discover_timeout")
|
2018-03-30 05:15:40 +02:00
|
|
|
|
2020-07-02 14:12:24 +02:00
|
|
|
if bridges:
|
|
|
|
# Find already configured hosts
|
|
|
|
already_configured = self._async_current_ids(False)
|
|
|
|
bridges = [
|
|
|
|
bridge for bridge in bridges if bridge.id not in already_configured
|
|
|
|
]
|
|
|
|
self.discovered_bridges = {bridge.id: bridge for bridge in bridges}
|
2018-03-30 05:15:40 +02:00
|
|
|
|
2020-07-02 14:12:24 +02:00
|
|
|
if not self.discovered_bridges:
|
|
|
|
return await self.async_step_manual()
|
2019-12-16 19:45:09 +01:00
|
|
|
|
2018-03-30 05:15:40 +02:00
|
|
|
return self.async_show_form(
|
2019-07-31 21:25:30 +02:00
|
|
|
step_id="init",
|
2019-12-16 19:45:09 +01:00
|
|
|
data_schema=vol.Schema(
|
|
|
|
{
|
|
|
|
vol.Required("id"): vol.In(
|
2020-07-02 14:12:24 +02:00
|
|
|
{
|
|
|
|
**{bridge.id: bridge.host for bridge in bridges},
|
|
|
|
HUE_MANUAL_BRIDGE_ID: "Manually add a Hue Bridge",
|
|
|
|
}
|
2019-12-16 19:45:09 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
),
|
2018-03-30 05:15:40 +02:00
|
|
|
)
|
|
|
|
|
2020-07-02 14:12:24 +02:00
|
|
|
async def async_step_manual(
|
2021-11-16 20:59:17 +01:00
|
|
|
self, user_input: ConfigType | None = None
|
2021-04-29 13:40:51 +02:00
|
|
|
) -> FlowResult:
|
2020-07-02 14:12:24 +02:00
|
|
|
"""Handle manual bridge setup."""
|
|
|
|
if user_input is None:
|
|
|
|
return self.async_show_form(
|
|
|
|
step_id="manual",
|
|
|
|
data_schema=vol.Schema({vol.Required(CONF_HOST): str}),
|
|
|
|
)
|
|
|
|
|
2021-05-11 22:00:12 +02:00
|
|
|
self._async_abort_entries_match({"host": user_input["host"]})
|
2021-11-16 20:59:17 +01:00
|
|
|
self.bridge = await self._get_bridge(user_input[CONF_HOST])
|
2020-07-02 14:12:24 +02:00
|
|
|
return await self.async_step_link()
|
|
|
|
|
2021-11-16 20:59:17 +01:00
|
|
|
async def async_step_link(self, user_input: ConfigType | None = None) -> FlowResult:
|
2018-03-30 05:15:40 +02:00
|
|
|
"""Attempt to link with the Hue bridge.
|
|
|
|
|
|
|
|
Given a configured host, will ask the user to press the link button
|
|
|
|
to connect to the bridge.
|
|
|
|
"""
|
2019-12-16 19:45:09 +01:00
|
|
|
if user_input is None:
|
|
|
|
return self.async_show_form(step_id="link")
|
|
|
|
|
|
|
|
bridge = self.bridge
|
|
|
|
assert bridge is not None
|
2018-03-30 05:15:40 +02:00
|
|
|
errors = {}
|
2021-11-16 20:59:17 +01:00
|
|
|
device_name = unicode_slug.slugify(
|
|
|
|
self.hass.config.location_name, max_length=19
|
|
|
|
)
|
2018-03-30 05:15:40 +02:00
|
|
|
|
|
|
|
try:
|
2021-11-16 20:59:17 +01:00
|
|
|
app_key = await create_app_key(
|
|
|
|
bridge.host,
|
|
|
|
f"home-assistant#{device_name}",
|
|
|
|
websession=aiohttp_client.async_get_clientsession(self.hass),
|
|
|
|
)
|
|
|
|
except LinkButtonNotPressed:
|
2019-07-31 21:25:30 +02:00
|
|
|
errors["base"] = "register_failed"
|
2018-03-30 05:15:40 +02:00
|
|
|
except CannotConnect:
|
2019-12-16 19:45:09 +01:00
|
|
|
LOGGER.error("Error connecting to the Hue bridge at %s", bridge.host)
|
2020-07-02 14:12:24 +02:00
|
|
|
return self.async_abort(reason="cannot_connect")
|
2018-03-30 05:15:40 +02:00
|
|
|
except Exception: # pylint: disable=broad-except
|
|
|
|
LOGGER.exception(
|
2019-12-16 19:45:09 +01:00
|
|
|
"Unknown error connecting with Hue bridge at %s", bridge.host
|
2019-07-31 21:25:30 +02:00
|
|
|
)
|
|
|
|
errors["base"] = "linking"
|
2018-03-30 05:15:40 +02:00
|
|
|
|
2020-07-02 14:12:24 +02:00
|
|
|
if errors:
|
|
|
|
return self.async_show_form(step_id="link", errors=errors)
|
|
|
|
|
|
|
|
# Can happen if we come from import or manual entry
|
|
|
|
if self.unique_id is None:
|
|
|
|
await self.async_set_unique_id(
|
|
|
|
normalize_bridge_id(bridge.id), raise_on_progress=False
|
|
|
|
)
|
|
|
|
|
|
|
|
return self.async_create_entry(
|
2021-11-16 20:59:17 +01:00
|
|
|
title=f"Hue Bridge {bridge.id}",
|
|
|
|
data={
|
|
|
|
CONF_HOST: bridge.host,
|
|
|
|
CONF_API_KEY: app_key,
|
|
|
|
CONF_API_VERSION: 2 if bridge.supports_v2 else 1,
|
|
|
|
},
|
2020-07-02 14:12:24 +02:00
|
|
|
)
|
2018-03-30 05:15:40 +02:00
|
|
|
|
2021-11-29 17:10:07 +01:00
|
|
|
async def async_step_ssdp(self, discovery_info: ssdp.SsdpServiceInfo) -> FlowResult:
|
2018-03-30 05:15:40 +02:00
|
|
|
"""Handle a discovered Hue bridge.
|
|
|
|
|
2019-05-27 04:48:27 +02:00
|
|
|
This flow is triggered by the SSDP component. It will check if the
|
2018-03-30 05:15:40 +02:00
|
|
|
host is already configured and delegate to the import step if not.
|
|
|
|
"""
|
2019-12-16 19:45:09 +01:00
|
|
|
# Filter out non-Hue bridges #1
|
2021-03-10 19:21:51 +01:00
|
|
|
if (
|
2021-11-30 16:36:35 +01:00
|
|
|
discovery_info.upnp.get(ssdp.ATTR_UPNP_MANUFACTURER_URL)
|
2021-03-10 19:21:51 +01:00
|
|
|
not in HUE_MANUFACTURERURL
|
|
|
|
):
|
2019-07-31 21:25:30 +02:00
|
|
|
return self.async_abort(reason="not_hue_bridge")
|
2019-06-03 18:26:01 +02:00
|
|
|
|
2019-12-16 19:45:09 +01:00
|
|
|
# Filter out non-Hue bridges #2
|
2019-12-01 06:28:42 +01:00
|
|
|
if any(
|
2021-11-30 16:36:35 +01:00
|
|
|
name in discovery_info.upnp.get(ssdp.ATTR_UPNP_FRIENDLY_NAME, "")
|
2019-12-01 06:28:42 +01:00
|
|
|
for name in HUE_IGNORED_BRIDGE_NAMES
|
|
|
|
):
|
|
|
|
return self.async_abort(reason="not_hue_bridge")
|
2018-03-30 05:15:40 +02:00
|
|
|
|
2019-12-19 18:28:03 +01:00
|
|
|
if (
|
2021-11-30 16:36:35 +01:00
|
|
|
not discovery_info.ssdp_location
|
|
|
|
or ssdp.ATTR_UPNP_SERIAL not in discovery_info.upnp
|
2019-12-19 18:28:03 +01:00
|
|
|
):
|
2019-12-16 19:45:09 +01:00
|
|
|
return self.async_abort(reason="not_hue_bridge")
|
2018-03-30 05:15:40 +02:00
|
|
|
|
2021-11-30 16:36:35 +01:00
|
|
|
url = urlparse(discovery_info.ssdp_location)
|
|
|
|
if not url.hostname:
|
|
|
|
return self.async_abort(reason="not_hue_bridge")
|
|
|
|
|
2021-12-05 18:46:48 +01:00
|
|
|
# abort if we already have exactly this bridge id/host
|
|
|
|
# reload the integration if the host got updated
|
|
|
|
bridge_id = normalize_bridge_id(discovery_info.upnp[ssdp.ATTR_UPNP_SERIAL])
|
|
|
|
await self.async_set_unique_id(bridge_id)
|
2020-08-08 20:23:56 +02:00
|
|
|
self._abort_if_unique_id_configured(
|
2021-12-05 18:46:48 +01:00
|
|
|
updates={CONF_HOST: url.hostname}, reload_on_update=True
|
2020-08-08 20:23:56 +02:00
|
|
|
)
|
2020-01-24 18:07:53 +01:00
|
|
|
|
2021-12-05 18:46:48 +01:00
|
|
|
self.bridge = await self._get_bridge(
|
|
|
|
url.hostname, discovery_info.upnp[ssdp.ATTR_UPNP_SERIAL]
|
|
|
|
)
|
2019-12-16 19:45:09 +01:00
|
|
|
return await self.async_step_link()
|
2019-06-08 07:59:51 +02:00
|
|
|
|
2021-10-31 16:13:26 +01:00
|
|
|
async def async_step_zeroconf(
|
2021-11-15 18:05:45 +01:00
|
|
|
self, discovery_info: zeroconf.ZeroconfServiceInfo
|
2021-10-31 16:13:26 +01:00
|
|
|
) -> FlowResult:
|
2021-09-13 05:00:51 +02:00
|
|
|
"""Handle a discovered Hue bridge.
|
|
|
|
|
|
|
|
This flow is triggered by the Zeroconf component. It will check if the
|
|
|
|
host is already configured and delegate to the import step if not.
|
|
|
|
"""
|
2021-12-05 18:46:48 +01:00
|
|
|
# abort if we already have exactly this bridge id/host
|
|
|
|
# reload the integration if the host got updated
|
|
|
|
bridge_id = normalize_bridge_id(discovery_info.properties["bridgeid"])
|
|
|
|
await self.async_set_unique_id(bridge_id)
|
2021-09-13 05:00:51 +02:00
|
|
|
self._abort_if_unique_id_configured(
|
2021-12-05 18:46:48 +01:00
|
|
|
updates={CONF_HOST: discovery_info.host}, reload_on_update=True
|
2021-09-13 05:00:51 +02:00
|
|
|
)
|
|
|
|
|
2021-12-05 18:46:48 +01:00
|
|
|
# we need to query the other capabilities too
|
|
|
|
self.bridge = await self._get_bridge(
|
|
|
|
discovery_info.host, discovery_info.properties["bridgeid"]
|
|
|
|
)
|
2021-09-13 05:00:51 +02:00
|
|
|
return await self.async_step_link()
|
|
|
|
|
2021-11-16 20:59:17 +01:00
|
|
|
async def async_step_homekit(
|
|
|
|
self, discovery_info: zeroconf.ZeroconfServiceInfo
|
|
|
|
) -> FlowResult:
|
2021-03-10 20:20:51 +01:00
|
|
|
"""Handle a discovered Hue bridge on HomeKit.
|
|
|
|
|
|
|
|
The bridge ID communicated over HomeKit differs, so we cannot use that
|
|
|
|
as the unique identifier. Therefore, this method uses discovery without
|
|
|
|
a unique ID.
|
|
|
|
"""
|
2021-11-30 16:36:35 +01:00
|
|
|
self.bridge = await self._get_bridge(discovery_info.host)
|
2021-03-10 20:20:51 +01:00
|
|
|
await self._async_handle_discovery_without_unique_id()
|
|
|
|
return await self.async_step_link()
|
|
|
|
|
2021-11-16 20:59:17 +01:00
|
|
|
async def async_step_import(self, import_info: ConfigType) -> FlowResult:
|
2018-03-30 05:15:40 +02:00
|
|
|
"""Import a new bridge as a config entry.
|
|
|
|
|
|
|
|
This flow is triggered by `async_setup` for both configured and
|
|
|
|
discovered bridges. Triggered for any bridge that does not have a
|
|
|
|
config entry yet (based on host).
|
|
|
|
|
|
|
|
This flow is also triggered by `async_step_discovery`.
|
|
|
|
"""
|
2019-12-16 19:45:09 +01:00
|
|
|
# Check if host exists, abort if so.
|
2021-05-11 22:00:12 +02:00
|
|
|
self._async_abort_entries_match({"host": import_info["host"]})
|
2018-03-30 05:15:40 +02:00
|
|
|
|
2021-11-16 20:59:17 +01:00
|
|
|
self.bridge = await self._get_bridge(import_info["host"])
|
2019-12-16 19:45:09 +01:00
|
|
|
return await self.async_step_link()
|
2020-07-02 14:12:24 +02:00
|
|
|
|
|
|
|
|
2021-12-31 05:46:52 +01:00
|
|
|
class HueV1OptionsFlowHandler(config_entries.OptionsFlow):
|
|
|
|
"""Handle Hue options for V1 implementation."""
|
2020-07-02 14:12:24 +02:00
|
|
|
|
2021-11-16 20:59:17 +01:00
|
|
|
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
|
2020-07-02 14:12:24 +02:00
|
|
|
"""Initialize Hue options flow."""
|
|
|
|
self.config_entry = config_entry
|
|
|
|
|
2021-11-16 20:59:17 +01:00
|
|
|
async def async_step_init(self, user_input: ConfigType | None = None) -> FlowResult:
|
2020-07-02 14:12:24 +02:00
|
|
|
"""Manage Hue options."""
|
|
|
|
if user_input is not None:
|
|
|
|
return self.async_create_entry(title="", data=user_input)
|
|
|
|
|
|
|
|
return self.async_show_form(
|
|
|
|
step_id="init",
|
|
|
|
data_schema=vol.Schema(
|
|
|
|
{
|
|
|
|
vol.Optional(
|
|
|
|
CONF_ALLOW_HUE_GROUPS,
|
|
|
|
default=self.config_entry.options.get(
|
2021-02-26 06:58:35 +01:00
|
|
|
CONF_ALLOW_HUE_GROUPS, DEFAULT_ALLOW_HUE_GROUPS
|
2020-07-02 14:12:24 +02:00
|
|
|
),
|
|
|
|
): bool,
|
|
|
|
vol.Optional(
|
|
|
|
CONF_ALLOW_UNREACHABLE,
|
|
|
|
default=self.config_entry.options.get(
|
2021-02-26 06:58:35 +01:00
|
|
|
CONF_ALLOW_UNREACHABLE, DEFAULT_ALLOW_UNREACHABLE
|
2020-07-02 14:12:24 +02:00
|
|
|
),
|
|
|
|
): bool,
|
|
|
|
}
|
|
|
|
),
|
|
|
|
)
|
2021-12-31 05:46:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
class HueV2OptionsFlowHandler(config_entries.OptionsFlow):
|
|
|
|
"""Handle Hue options for V2 implementation."""
|
|
|
|
|
|
|
|
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
|
|
|
|
"""Initialize Hue options flow."""
|
|
|
|
self.config_entry = config_entry
|
|
|
|
|
|
|
|
async def async_step_init(self, user_input: ConfigType | None = None) -> FlowResult:
|
|
|
|
"""Manage Hue options."""
|
|
|
|
if user_input is not None:
|
|
|
|
return self.async_create_entry(title="", data=user_input)
|
|
|
|
|
|
|
|
# create a list of Hue device ID's that the user can select
|
|
|
|
# to ignore availability status
|
|
|
|
dev_reg = device_registry.async_get(self.hass)
|
|
|
|
entries = device_registry.async_entries_for_config_entry(
|
|
|
|
dev_reg, self.config_entry.entry_id
|
|
|
|
)
|
|
|
|
dev_ids = {
|
|
|
|
identifier[1]: entry.name
|
|
|
|
for entry in entries
|
|
|
|
for identifier in entry.identifiers
|
|
|
|
if identifier[0] == DOMAIN
|
|
|
|
}
|
|
|
|
# filter any non existing device id's from the list
|
|
|
|
cur_ids = [
|
|
|
|
item
|
|
|
|
for item in self.config_entry.options.get(CONF_IGNORE_AVAILABILITY, [])
|
|
|
|
if item in dev_ids
|
|
|
|
]
|
|
|
|
|
|
|
|
return self.async_show_form(
|
|
|
|
step_id="init",
|
|
|
|
data_schema=vol.Schema(
|
|
|
|
{
|
|
|
|
vol.Optional(
|
|
|
|
CONF_IGNORE_AVAILABILITY,
|
|
|
|
default=cur_ids,
|
|
|
|
): cv.multi_select(dev_ids),
|
|
|
|
}
|
|
|
|
),
|
|
|
|
)
|