Initial commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
"""
|
||||
Place this code in custom_components/heat_pump_monitor/config_flow.py
|
||||
"""
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.const import CONF_URL, CONF_SCAN_INTERVAL
|
||||
import voluptuous as vol
|
||||
|
||||
class HeatPumpMonitorConfigFlow(config_entries.ConfigFlow, domain="heat_pump_monitor"):
|
||||
"""Handle a config flow."""
|
||||
|
||||
VERSION = 1
|
||||
|
||||
async def async_step_user(self, user_input=None):
|
||||
"""Handle the initial step."""
|
||||
errors = {}
|
||||
|
||||
if user_input is not None:
|
||||
return self.async_create_entry(
|
||||
title="Heat Pump Monitor",
|
||||
data={
|
||||
CONF_URL: user_input[CONF_URL],
|
||||
CONF_SCAN_INTERVAL: user_input.get(CONF_SCAN_INTERVAL, 3),
|
||||
},
|
||||
)
|
||||
|
||||
return self.async_show_form(
|
||||
step_id="user",
|
||||
data_schema=vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_URL): str,
|
||||
vol.Optional(CONF_SCAN_INTERVAL, default=3): int,
|
||||
}
|
||||
),
|
||||
errors=errors,
|
||||
)
|
||||
Reference in New Issue
Block a user