hass-core/homeassistant/components/heos/config_flow.py
Andrew Sayre 1bfe86b30d Change HEOS component library and add basic config flow (#22517)
* Update heos lib

* Update requirements files

* Removed unecessary mock_coro usage

* Remove assert_called_once usage

* Updates from review feedback

* Remove extra param to error format
2019-03-29 21:10:00 -07:00

25 lines
747 B
Python

"""Config flow to configure Heos."""
from homeassistant import config_entries
from homeassistant.const import CONF_HOST
from .const import DOMAIN
def format_title(host: str) -> str:
"""Format the title for config entries."""
return "Controller ({})".format(host)
@config_entries.HANDLERS.register(DOMAIN)
class HeosFlowHandler(config_entries.ConfigFlow):
"""Define a flow for HEOS."""
VERSION = 1
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH
async def async_step_import(self, user_input=None):
"""Occurs when an entry is setup through config."""
host = user_input[CONF_HOST]
return self.async_create_entry(
title=format_title(host),
data={CONF_HOST: host})