Home Assistant Unofficial Reference
2024.12.1
config_flow.py
Go to the documentation of this file.
1
"""Config flow to configure DSMR Reader."""
2
3
from
__future__
import
annotations
4
5
from
collections.abc
import
Awaitable
6
from
typing
import
Any
7
8
from
homeassistant.config_entries
import
ConfigFlowResult
9
from
homeassistant.core
import
HomeAssistant
10
from
homeassistant.helpers.config_entry_flow
import
DiscoveryFlowHandler
11
12
from
.const
import
DOMAIN
13
14
15
async
def
_async_has_devices
(_: HomeAssistant) -> bool:
16
"""MQTT is set as dependency, so that should be sufficient."""
17
return
True
18
19
20
class
DsmrReaderFlowHandler
(
DiscoveryFlowHandler
[Awaitable[bool]], domain=DOMAIN):
21
"""Handle DSMR Reader config flow. The MQTT step is inherited from the parent class."""
22
23
VERSION = 1
24
25
def
__init__
(self) -> None:
26
"""Set up the config flow."""
27
super().
__init__
(DOMAIN,
"DSMR Reader"
, _async_has_devices)
28
29
async
def
async_step_confirm
(
30
self, user_input: dict[str, Any] |
None
=
None
31
) -> ConfigFlowResult:
32
"""Confirm setup."""
33
if
user_input
is
None
:
34
return
self.async_show_form(
35
step_id=
"confirm"
,
36
)
37
38
return
await super().
async_step_confirm
(user_input)
homeassistant.components.dsmr_reader.config_flow.DsmrReaderFlowHandler
Definition:
config_flow.py:20
homeassistant.components.dsmr_reader.config_flow.DsmrReaderFlowHandler.async_step_confirm
ConfigFlowResult async_step_confirm(self, dict[str, Any]|None user_input=None)
Definition:
config_flow.py:31
homeassistant.components.dsmr_reader.config_flow.DsmrReaderFlowHandler.__init__
None __init__(self)
Definition:
config_flow.py:25
homeassistant.helpers.config_entry_flow.DiscoveryFlowHandler
Definition:
config_entry_flow.py:30
homeassistant.components.dsmr_reader.config_flow._async_has_devices
bool _async_has_devices(HomeAssistant _)
Definition:
config_flow.py:15
homeassistant.config_entries
Definition:
config_entries.py:1
homeassistant.core
Definition:
core.py:1
homeassistant.helpers.config_entry_flow
Definition:
config_entry_flow.py:1
core
homeassistant
components
dsmr_reader
config_flow.py
Generated by
1.9.1