-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_flow.py
More file actions
43 lines (36 loc) · 1.35 KB
/
Copy pathconfig_flow.py
File metadata and controls
43 lines (36 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""Config flow for prix_carburants_fr."""
import logging
import voluptuous as vol
from typing import Any, Dict, Optional
from homeassistant import config_entries
from homeassistant.helpers import selector
from homeassistant.data_entry_flow import FlowResult
from homeassistant.core import HomeAssistant
_LOGGER = logging.getLogger(__name__)
DOMAIN = "prix_carburants_fr"
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Config flow for prix_carburants_fr."""
VERSION = 1
async def async_step_user(
self, user_input: Optional[Dict[str, Any]] = None
) -> FlowResult:
"""Handle a user step."""
if user_input is not None:
return self.async_create_entry(
title="Prix Carburants France",
data=user_input,
)
return self.async_show_form(
step_id="user",
data_schema=vol.Schema(
{
vol.Required("tracker_entity"): str,
vol.Required("name", default="Prix Carburants"): str,
vol.Optional("rayon_km", default="20"): str,
vol.Optional("nb_stations", default="5"): str,
}
),
description_placeholders={
"tracker_help": "Entity GPS (device_tracker.xxx ou sensor.xxx_location)"
},
)