Skip to content

Commit

Permalink
Update config_flow.py
Browse files Browse the repository at this point in the history
  • Loading branch information
wimb0 authored Feb 11, 2025
1 parent bd02d74 commit 19598fe
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions custom_components/saj_modbus/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import (CONF_HOST, CONF_NAME, CONF_PORT,
CONF_SCAN_INTERVAL)
from homeassistant.core import HomeAssistant, callback
Expand Down Expand Up @@ -32,10 +38,10 @@ def host_valid(host):
@callback
def saj_modbus_entries(hass: HomeAssistant):
"""Return the hosts already configured."""
return set(
entry.data[CONF_HOST] for entry in hass.config_entries.async_entries(DOMAIN)
)

return {
config_entry.data.get(CONF_HOST)
for config_entry in hass.config_entries.async_entries(DOMAIN)
}

class SAJModbusConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""SAJ Modbus configflow."""
Expand Down

0 comments on commit 19598fe

Please sign in to comment.