Address review comments on dsmr update to ConfigEntry (#39662)
This commit is contained in:
parent
767be18265
commit
7f7a0003c7
2 changed files with 4 additions and 2 deletions
|
@ -24,7 +24,7 @@ class DSMRFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
reload_on_update: bool = True,
|
||||
):
|
||||
"""Test if host and port are already configured."""
|
||||
for entry in self.hass.config_entries.async_entries(DOMAIN):
|
||||
for entry in self._async_current_entries():
|
||||
if entry.data.get(CONF_HOST) == host and entry.data[CONF_PORT] == port:
|
||||
if updates is not None:
|
||||
changed = self.hass.config_entries.async_update_entry(
|
||||
|
@ -44,6 +44,8 @@ class DSMRFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
)
|
||||
return self.async_abort(reason="already_configured")
|
||||
|
||||
return None
|
||||
|
||||
async def async_step_import(self, import_config=None):
|
||||
"""Handle the initial step."""
|
||||
host = import_config.get(CONF_HOST)
|
||||
|
|
|
@ -200,7 +200,7 @@ async def async_setup_entry(
|
|||
return
|
||||
|
||||
# Can't be hass.async_add_job because job runs forever
|
||||
task = hass.loop.create_task(connect_and_reconnect())
|
||||
task = asyncio.create_task(connect_and_reconnect())
|
||||
|
||||
# Save the task to be able to cancel it when unloading
|
||||
hass.data[DOMAIN][entry.entry_id][DATA_TASK] = task
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue