mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 01:07:10 +00:00
Only initialize Nuki configurations (#49747)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
parent
93628554cb
commit
316f6ba397
@ -10,7 +10,7 @@ from requests.exceptions import RequestException
|
||||
|
||||
from homeassistant import exceptions
|
||||
from homeassistant.config_entries import SOURCE_IMPORT
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_TOKEN
|
||||
from homeassistant.const import CONF_HOST, CONF_PLATFORM, CONF_PORT, CONF_TOKEN
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
@ -22,6 +22,7 @@ from .const import (
|
||||
DATA_COORDINATOR,
|
||||
DATA_LOCKS,
|
||||
DATA_OPENERS,
|
||||
DEFAULT_PORT,
|
||||
DEFAULT_TIMEOUT,
|
||||
DOMAIN,
|
||||
ERROR_STATES,
|
||||
@ -59,11 +60,18 @@ async def async_setup(hass, config):
|
||||
continue
|
||||
|
||||
for conf in confs:
|
||||
hass.async_create_task(
|
||||
hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_IMPORT}, data=conf
|
||||
if CONF_PLATFORM in conf and conf[CONF_PLATFORM] == DOMAIN:
|
||||
hass.async_create_task(
|
||||
hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_IMPORT},
|
||||
data={
|
||||
CONF_HOST: conf[CONF_HOST],
|
||||
CONF_PORT: conf.get(CONF_PORT, DEFAULT_PORT),
|
||||
CONF_TOKEN: conf[CONF_TOKEN],
|
||||
},
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user