mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Activate manual ZHA config flow when no comports detected (#46077)
This commit is contained in:
parent
434b4dfa58
commit
67392338da
@ -45,6 +45,10 @@ class ZhaFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
+ (f" - {p.manufacturer}" if p.manufacturer else "")
|
||||
for p in ports
|
||||
]
|
||||
|
||||
if not list_of_ports:
|
||||
return await self.async_step_pick_radio()
|
||||
|
||||
list_of_ports.append(CONF_MANUAL_PATH)
|
||||
|
||||
if user_input is not None:
|
||||
|
@ -74,6 +74,7 @@ async def test_user_flow_not_detected(detect_mock, hass):
|
||||
assert detect_mock.await_args[0][0] == port.device
|
||||
|
||||
|
||||
@patch("serial.tools.list_ports.comports", MagicMock(return_value=[com_port()]))
|
||||
async def test_user_flow_show_form(hass):
|
||||
"""Test user step form."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
@ -85,6 +86,17 @@ async def test_user_flow_show_form(hass):
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
async def test_user_flow_show_manual(hass):
|
||||
"""Test user flow manual entry when no comport detected."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={CONF_SOURCE: SOURCE_USER},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["step_id"] == "pick_radio"
|
||||
|
||||
|
||||
async def test_user_flow_manual(hass):
|
||||
"""Test user flow manual entry."""
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user