pass configuration to import step

This commit is contained in:
escoand
2020-01-02 21:20:20 +01:00
parent 967f376e1f
commit dceea6f773
2 changed files with 6 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
"""The Samsung TV integration."""
from wakeonlan import BROADCAST_IP
import voluptuous as vol
from wakeonlan import BROADCAST_IP
from homeassistant.const import (
CONF_BROADCAST_ADDRESS,
@@ -14,7 +14,6 @@ import homeassistant.helpers.config_validation as cv
from .const import DEFAULT_NAME, DEFAULT_TIMEOUT, DOMAIN
CONFIG_SCHEMA = vol.Schema(
{
DOMAIN: vol.All(
@@ -45,7 +44,7 @@ async def async_setup(hass, config):
if DOMAIN in config:
for entry_config in config[DOMAIN]:
await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "user"}, data=entry_config
DOMAIN, context={"source": "import"}, data=entry_config
)
return True

View File

@@ -116,6 +116,10 @@ class SamsungTVConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
},
)
async def async_step_import(self, user_input=None):
"""Handle configuration by yaml file."""
return await self.async_step_user(user_input)
async def async_step_user(self, user_input=None):
"""Handle a flow initialized by the user."""
if user_input is not None: