Home Assistant Unofficial Reference
2024.12.1
config_flow.py
Go to the documentation of this file.
1
"""Config flow for Fjäråskupan integration."""
2
3
from
__future__
import
annotations
4
5
from
fjaraskupan
import
device_filter
6
7
from
homeassistant.components.bluetooth
import
async_discovered_service_info
8
from
homeassistant.core
import
HomeAssistant
9
from
homeassistant.helpers.config_entry_flow
import
register_discovery_flow
10
11
from
.const
import
DOMAIN
12
13
14
async
def
_async_has_devices
(hass: HomeAssistant) -> bool:
15
"""Return if there are devices that can be discovered."""
16
17
service_infos =
async_discovered_service_info
(hass)
18
19
for
service_info
in
service_infos:
20
if
device_filter(service_info.device, service_info.advertisement):
21
return
True
22
23
return
False
24
25
26
register_discovery_flow
(DOMAIN,
"Fjäråskupan"
, _async_has_devices)
homeassistant.components.bluetooth.api.async_discovered_service_info
Iterable[BluetoothServiceInfoBleak] async_discovered_service_info(HomeAssistant hass, bool connectable=True)
Definition:
api.py:72
homeassistant.components.bluetooth
Definition:
__init__.py:1
homeassistant.components.fjaraskupan.config_flow._async_has_devices
bool _async_has_devices(HomeAssistant hass)
Definition:
config_flow.py:14
homeassistant.core
Definition:
core.py:1
homeassistant.helpers.config_entry_flow
Definition:
config_entry_flow.py:1
homeassistant.helpers.config_entry_flow.register_discovery_flow
None register_discovery_flow(str domain, str title, DiscoveryFunctionType[Awaitable[bool]|bool] discovery_function)
Definition:
config_entry_flow.py:182
core
homeassistant
components
fjaraskupan
config_flow.py
Generated by
1.9.1