2019-05-13 08:16:55 +00:00
|
|
|
"""Config flow for Mobile App."""
|
|
|
|
from homeassistant import config_entries
|
|
|
|
from .const import DOMAIN, ATTR_DEVICE_NAME
|
|
|
|
|
|
|
|
|
|
|
|
@config_entries.HANDLERS.register(DOMAIN)
|
|
|
|
class MobileAppFlowHandler(config_entries.ConfigFlow):
|
|
|
|
"""Handle a Mobile App config flow."""
|
|
|
|
|
|
|
|
VERSION = 1
|
|
|
|
CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_PUSH
|
|
|
|
|
|
|
|
async def async_step_user(self, user_input=None):
|
|
|
|
"""Handle a flow initialized by the user."""
|
|
|
|
placeholders = {
|
2019-07-31 19:25:30 +00:00
|
|
|
"apps_url": "https://www.home-assistant.io/components/mobile_app/#apps"
|
2019-05-13 08:16:55 +00:00
|
|
|
}
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
return self.async_abort(
|
|
|
|
reason="install_app", description_placeholders=placeholders
|
|
|
|
)
|
2019-05-13 08:16:55 +00:00
|
|
|
|
|
|
|
async def async_step_registration(self, user_input=None):
|
|
|
|
"""Handle a flow initialized during registration."""
|
2019-07-31 19:25:30 +00:00
|
|
|
return self.async_create_entry(
|
|
|
|
title=user_input[ATTR_DEVICE_NAME], data=user_input
|
|
|
|
)
|