1 """The Aranet integration."""
3 from __future__
import annotations
7 from aranet4.client
import Aranet4Advertisement
12 PassiveBluetoothProcessorCoordinator,
18 PLATFORMS: list[Platform] = [Platform.SENSOR]
20 _LOGGER = logging.getLogger(__name__)
22 type AranetConfigEntry = ConfigEntry[
23 PassiveBluetoothProcessorCoordinator[Aranet4Advertisement]
28 service_info: BluetoothServiceInfoBleak,
29 ) -> Aranet4Advertisement:
30 return Aranet4Advertisement(service_info.device, service_info.advertisement)
34 """Set up Aranet from a config entry."""
36 address = entry.unique_id
37 assert address
is not None
42 mode=BluetoothScanningMode.PASSIVE,
43 update_method=_service_info_to_adv,
45 entry.runtime_data = coordinator
46 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
48 entry.async_on_unload(coordinator.async_start())
53 """Unload a config entry."""
54 return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_unload_entry(HomeAssistant hass, AranetConfigEntry entry)
bool async_setup_entry(HomeAssistant hass, AranetConfigEntry entry)
Aranet4Advertisement _service_info_to_adv(BluetoothServiceInfoBleak service_info)