mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Address review comments on dsmr update to ConfigEntry (#39662)
This commit is contained in:
parent
767be18265
commit
7f7a0003c7
@ -24,7 +24,7 @@ class DSMRFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
reload_on_update: bool = True,
|
reload_on_update: bool = True,
|
||||||
):
|
):
|
||||||
"""Test if host and port are already configured."""
|
"""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 entry.data.get(CONF_HOST) == host and entry.data[CONF_PORT] == port:
|
||||||
if updates is not None:
|
if updates is not None:
|
||||||
changed = self.hass.config_entries.async_update_entry(
|
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 self.async_abort(reason="already_configured")
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
async def async_step_import(self, import_config=None):
|
async def async_step_import(self, import_config=None):
|
||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
host = import_config.get(CONF_HOST)
|
host = import_config.get(CONF_HOST)
|
||||||
|
@ -200,7 +200,7 @@ async def async_setup_entry(
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Can't be hass.async_add_job because job runs forever
|
# 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
|
# Save the task to be able to cancel it when unloading
|
||||||
hass.data[DOMAIN][entry.entry_id][DATA_TASK] = task
|
hass.data[DOMAIN][entry.entry_id][DATA_TASK] = task
|
||||||
|
Loading…
x
Reference in New Issue
Block a user