Add config step definition
This commit is contained in:
@@ -27,8 +27,8 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
CONFIG_SCHEMA = vol.Schema(
|
CONFIG_SCHEMA = vol.Schema(
|
||||||
{
|
{
|
||||||
vol.Required(DOMAIN, default={}): {
|
vol.Required(DOMAIN, default={}): {
|
||||||
vol.Required(CONF_EMAIL): vol.All(str, vol.Length(min=3)),
|
vol.Optional(CONF_EMAIL): vol.All(str, vol.Length(min=3)),
|
||||||
vol.Required(CONF_PASSWORD): vol.All(str)
|
vol.Optional(CONF_PASSWORD): vol.All(str)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
extra=vol.ALLOW_EXTRA,
|
extra=vol.ALLOW_EXTRA,
|
||||||
|
|||||||
@@ -1,16 +1,21 @@
|
|||||||
""" Georide config flow file """
|
""" Georide config flow """
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN, CONF_EMAIL, CONF_PASSWORD
|
||||||
|
|
||||||
|
STEP_ID = 'user'
|
||||||
|
|
||||||
class GeorideConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class GeorideConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
"""Geride config flow """
|
"""Geride config flow """
|
||||||
async def async_step_user(self, info):
|
|
||||||
return self.async_show_form(
|
async def async_step_user(self, user_input=None):
|
||||||
step_id='user',
|
""" handle info to help to configure georide """
|
||||||
data_schema=vol.Schema({
|
if user_input is None:
|
||||||
vol.Required('password'): str
|
return self.async_show_form(step_id=STEP_ID, data_schema=vol.Schema({
|
||||||
|
vol.Required(CONF_EMAIL): vol.All(str, vol.Length(min=3)),
|
||||||
|
vol.Required(CONF_PASSWORD): vol.All(str)
|
||||||
}))
|
}))
|
||||||
|
# process info
|
||||||
|
|
||||||
|
|||||||
17
custom_components/georide/strings.json
Normal file
17
custom_components/georide/strings.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"title": "Georide",
|
||||||
|
"step": {
|
||||||
|
"user": {
|
||||||
|
"title": "Set up Georide",
|
||||||
|
"description": "Are you sure you want to set up OwnTracks?"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"abort": {
|
||||||
|
"one_instance_allowed": "Only a single instance is allowed."
|
||||||
|
},
|
||||||
|
"create_entry": {
|
||||||
|
"default": "\n\nJust give your credentials"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user