From ffa7cac38e7860e757a6adec34b5381900da7832 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 16 Feb 2023 15:51:27 -0600 Subject: [PATCH] Switch switchbot to use no_devices_found (#88268) --- homeassistant/components/switchbot/config_flow.py | 2 +- homeassistant/components/switchbot/strings.json | 2 +- tests/components/switchbot/test_config_flow.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/switchbot/config_flow.py b/homeassistant/components/switchbot/config_flow.py index 1374e93326c..35e76d8bbb3 100644 --- a/homeassistant/components/switchbot/config_flow.py +++ b/homeassistant/components/switchbot/config_flow.py @@ -272,7 +272,7 @@ class SwitchbotConfigFlow(ConfigFlow, domain=DOMAIN): self._discovered_advs[address] = parsed if not self._discovered_advs: - raise AbortFlow("no_unconfigured_devices") + raise AbortFlow("no_devices_found") async def _async_set_device(self, discovery: SwitchBotAdvertisement) -> None: """Set the device to work with.""" diff --git a/homeassistant/components/switchbot/strings.json b/homeassistant/components/switchbot/strings.json index d263aed3dd5..3262ffbd7bb 100644 --- a/homeassistant/components/switchbot/strings.json +++ b/homeassistant/components/switchbot/strings.json @@ -44,7 +44,7 @@ }, "abort": { "already_configured_device": "[%key:common::config_flow::abort::already_configured_device%]", - "no_unconfigured_devices": "No unconfigured devices found.", + "no_devices_found": "[%key:common::config_flow::abort::no_devices_found%]", "unknown": "[%key:common::config_flow::error::unknown%]", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "switchbot_unsupported_type": "Unsupported Switchbot Type." diff --git a/tests/components/switchbot/test_config_flow.py b/tests/components/switchbot/test_config_flow.py index 491c67d7a00..85174658279 100644 --- a/tests/components/switchbot/test_config_flow.py +++ b/tests/components/switchbot/test_config_flow.py @@ -249,7 +249,7 @@ async def test_user_setup_wohand_already_configured(hass: HomeAssistant) -> None DOMAIN, context={"source": SOURCE_USER} ) assert result["type"] == FlowResultType.ABORT - assert result["reason"] == "no_unconfigured_devices" + assert result["reason"] == "no_devices_found" async def test_user_setup_wocurtain(hass: HomeAssistant) -> None: @@ -662,7 +662,7 @@ async def test_user_no_devices(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER} ) assert result["type"] == FlowResultType.ABORT - assert result["reason"] == "no_unconfigured_devices" + assert result["reason"] == "no_devices_found" async def test_async_step_user_takes_precedence_over_discovery(