8000 components/husqvarna_automower_ble: Raise ConfigEntryNotReady on init… · home-assistant/core@4188264 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4188264

Browse files
committed
components/husqvarna_automower_ble: Raise ConfigEntryNotReady on init errors
Signed-off-by: Alistair Francis <alistair@alistair23.me>
1 parent 7a18d19 commit 4188264

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

homeassistant/components/husqvarna_automower_ble/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from homeassistant.config_entries import ConfigEntry
1111
from homeassistant.const import CONF_ADDRESS, CONF_CLIENT_ID, CONF_PIN, Platform
1212
from homeassistant.core import HomeAssistant
13-
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
13+
from homeassistant.exceptions import ConfigEntryNotReady
1414

1515
from .const import LOGGER
1616
from .coordinator import HusqvarnaCoordinator
@@ -36,7 +36,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
3636
hass, address, connectable=True
3737
) or await get_device(address)
3838
if not await mower.connect(device):
39-
raise ConfigEntryAuthFailed(f"Unable to connect to device {address}")
39+
raise ConfigEntryNotReady
4040
except (TimeoutError, BleakError) as exception:
4141
raise ConfigEntryNotReady(
4242
f"Unable to connect to device {address} due to {exception}"

tests/components/husqvarna_automower_ble/test_init.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,4 @@ async def test_setup_invalid_pin(
6666
await hass.config_entries.async_setup(mock_config_entry.entry_id)
6767
await hass.async_block_till_done()
6868

69-
assert mock_config_entry.state is ConfigEntryState.SETUP_ERROR
70-
71-
flows = hass.config_entries.flow.async_progress()
72-
assert len(flows) == 1
73-
assert flows[0]["step_id"] == "reauth_confirm"
74-
75-
hass.config_entries.flow.async_abort(flows[0]["flow_id"])
76-
assert not hass.config_entries.flow.async_progress()
69+
assert mock_config_entry.state is ConfigEntryState.SETUP_RETRY

0 commit comments

Comments
 (0)
0