1 """The rapt_ble integration."""
3 from __future__
import annotations
7 from rapt_ble
import RAPTPillBluetoothDeviceData
11 PassiveBluetoothProcessorCoordinator,
17 from .const
import DOMAIN
19 PLATFORMS: list[Platform] = [Platform.SENSOR]
21 _LOGGER = logging.getLogger(__name__)
25 """Set up RAPT BLE device from a config entry."""
26 address = entry.unique_id
27 assert address
is not None
28 data = RAPTPillBluetoothDeviceData()
29 coordinator = hass.data.setdefault(DOMAIN, {})[entry.entry_id] = (
34 mode=BluetoothScanningMode.ACTIVE,
35 update_method=data.update,
38 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
39 entry.async_on_unload(
40 coordinator.async_start()
46 """Unload a config entry."""
47 if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
48 hass.data[DOMAIN].pop(entry.entry_id)
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
bool async_setup_entry(HomeAssistant hass, ConfigEntry entry)