mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Disable options flow for Hue V2 bridges (#61045)
This commit is contained in:
parent
11e2f51681
commit
b98bc64604
@ -12,7 +12,7 @@ import async_timeout
|
||||
import slugify as unicode_slug
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant.components import ssdp, zeroconf
|
||||
from homeassistant.const import CONF_API_KEY, CONF_HOST
|
||||
from homeassistant.core import callback
|
||||
@ -48,7 +48,10 @@ class HueFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
config_entry: config_entries.ConfigEntry,
|
||||
) -> HueOptionsFlowHandler:
|
||||
"""Get the options flow for this handler."""
|
||||
if config_entry.data.get(CONF_API_VERSION, 1) == 1:
|
||||
# Options for Hue are only applicable to V1 bridges.
|
||||
return HueOptionsFlowHandler(config_entry)
|
||||
raise data_entry_flow.UnknownHandler
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Initialize the Hue flow."""
|
||||
@ -292,10 +295,6 @@ class HueOptionsFlowHandler(config_entries.OptionsFlow):
|
||||
if user_input is not None:
|
||||
return self.async_create_entry(title="", data=user_input)
|
||||
|
||||
if self.config_entry.data.get(CONF_API_VERSION, 1) > 1:
|
||||
# Options for Hue are only applicable to V1 bridges.
|
||||
return self.async_show_form(step_id="init")
|
||||
|
||||
return self.async_show_form(
|
||||
step_id="init",
|
||||
data_schema=vol.Schema(
|
||||
|
@ -7,7 +7,7 @@ from aiohue.errors import LinkButtonNotPressed
|
||||
import pytest
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant.components import ssdp, zeroconf
|
||||
from homeassistant.components.hue import config_flow, const
|
||||
from homeassistant.components.hue.errors import CannotConnect
|
||||
@ -706,12 +706,8 @@ async def test_options_flow_v2(hass):
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == "form"
|
||||
assert result["step_id"] == "init"
|
||||
# V2 bridge does not have config options
|
||||
assert result["data_schema"] is None
|
||||
with pytest.raises(data_entry_flow.UnknownHandler):
|
||||
await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
|
||||
async def test_bridge_zeroconf(hass, aioclient_mock):
|
||||
|
Loading…
x
Reference in New Issue
Block a user