Skip to content

Commit 754aaf6

Browse files
Merge pull request #665 from WillCodeForCats/code-quality
Remove redundant code for unique id check
2 parents c8a8843 + 567f646 commit 754aaf6

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

custom_components/solaredge_modbus_multi/config_flow.py

+1-12
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from homeassistant import config_entries
1111
from homeassistant.config_entries import ConfigEntry, OptionsFlow
1212
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, CONF_SCAN_INTERVAL
13-
from homeassistant.core import HomeAssistant, callback
13+
from homeassistant.core import callback
1414
from homeassistant.data_entry_flow import FlowResult
1515
from homeassistant.exceptions import HomeAssistantError
1616

@@ -45,15 +45,6 @@ def generate_config_schema(step_id: str, user_input: dict[str, Any]) -> vol.Sche
4545
return vol.Schema(schema)
4646

4747

48-
@callback
49-
def solaredge_modbus_multi_entries(hass: HomeAssistant):
50-
"""Return the hosts already configured."""
51-
return set(
52-
entry.data[CONF_HOST].lower()
53-
for entry in hass.config_entries.async_entries(DOMAIN)
54-
)
55-
56-
5748
class SolaredgeModbusMultiConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
5849
"""Handle a config flow for SolarEdge Modbus Multi."""
5950

@@ -88,8 +79,6 @@ async def async_step_user(
8879
else:
8980
if not host_valid(user_input[CONF_HOST]):
9081
errors[CONF_HOST] = "invalid_host"
91-
elif user_input[CONF_HOST] in solaredge_modbus_multi_entries(self.hass):
92-
errors[CONF_HOST] = "already_configured"
9382
elif not 1 <= user_input[CONF_PORT] <= 65535:
9483
errors[CONF_PORT] = "invalid_tcp_port"
9584
elif not 1 <= inverter_count <= 32:

0 commit comments

Comments
 (0)