Skip to content

Commit eb9fbeb

Browse files
Explicit name fast scan with no default
1 parent f9a74d4 commit eb9fbeb

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

custom_components/solaredge_modbus_multi/config_flow.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
from homeassistant.config_entries import ConfigEntry, ConfigFlowResult, OptionsFlow
1212
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, CONF_SCAN_INTERVAL
1313
from homeassistant.core import callback
14-
from homeassistant.data_entry_flow import FlowResult
14+
from homeassistant.data_entry_flow import AbortFlow, FlowResult
1515
from homeassistant.exceptions import HomeAssistantError
1616

1717
from .const import (
1818
DEFAULT_NAME,
1919
DOMAIN,
2020
SETUP_MANUAL,
21-
SETUP_SCAN,
21+
SETUP_SCAN_FAST,
2222
SETUP_SCAN_FULL,
2323
SETUP_TYPE,
2424
ConfDefaultFlag,
@@ -67,9 +67,9 @@ async def async_step_user(
6767
"""Handle the initial step."""
6868
data_schema = vol.Schema(
6969
{
70-
vol.Required(SETUP_TYPE, default=SETUP_SCAN): vol.In(
70+
vol.Required(SETUP_TYPE, default=SETUP_SCAN_FAST): vol.In(
7171
(
72-
SETUP_SCAN,
72+
SETUP_SCAN_FAST,
7373
SETUP_SCAN_FULL,
7474
SETUP_MANUAL,
7575
)
@@ -83,13 +83,16 @@ async def async_step_user(
8383
data_schema=data_schema,
8484
)
8585

86-
if user_input[SETUP_TYPE] == SETUP_MANUAL:
87-
return await self.async_step_manual()
86+
if user_input[SETUP_TYPE] == SETUP_SCAN_FAST:
87+
return await self.async_step_scan_fast()
8888
if user_input[SETUP_TYPE] == SETUP_SCAN_FULL:
8989
return await self.async_step_scan_full()
90-
return await self.async_step_scan()
90+
if user_input[SETUP_TYPE] == SETUP_MANUAL:
91+
return await self.async_step_manual()
92+
93+
raise AbortFlow(f"Unknown setup type: {user_input[SETUP_TYPE]}")
9194

92-
async def async_step_scan(
95+
async def async_step_scan_fast(
9396
self, user_input: dict[str, Any] | None = None
9497
) -> ConfigFlowResult:
9598
"""
@@ -98,7 +101,7 @@ async def async_step_scan(
98101
"""
99102
errors = {}
100103

101-
raise HomeAssistantError("async_step_scan")
104+
raise AbortFlow("async_step_scan_fast")
102105

103106
async def async_step_scan_full(
104107
self, user_input: dict[str, Any] | None = None
@@ -109,7 +112,7 @@ async def async_step_scan_full(
109112
"""
110113
errors = {}
111114

112-
raise HomeAssistantError("async_step_scan_full")
115+
raise AbortFlow("async_step_scan_full")
113116

114117
async def async_step_manual(
115118
self, user_input: dict[str, Any] | None = None

custom_components/solaredge_modbus_multi/const.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
DEFAULT_NAME = "SolarEdge"
1111

1212
SETUP_TYPE = "setup_type"
13-
SETUP_SCAN = "Scanning Setup" # Scan IDs 1-32
14-
SETUP_SCAN_FULL = "Scanning Setup (Full)" # Scan IDs 1-247
13+
SETUP_SCAN_FAST = "Scan for Inverters (Fast: IDs 1-32)" # Scan IDs 1-32
14+
SETUP_SCAN_FULL = "Scan for Inverters (Full: IDs 1-247)" # Scan IDs 1-247
1515
SETUP_MANUAL = "Manual Setup"
1616

1717
# raise a startup exception if pymodbus version is less than this

0 commit comments

Comments
 (0)