1212from homeassistant .const import Platform
1313from homeassistant .core import HomeAssistant
1414
15- from .const import DOMAIN
16-
1715PLATFORMS : list [Platform ] = [Platform .SENSOR ]
1816
1917_LOGGER = logging .getLogger (__name__ )
2018
19+ type ThermoBeaconConfigEntry = ConfigEntry [PassiveBluetoothProcessorCoordinator ]
20+
2121
22- async def async_setup_entry (hass : HomeAssistant , entry : ConfigEntry ) -> bool :
22+ async def async_setup_entry (
23+ hass : HomeAssistant , entry : ThermoBeaconConfigEntry
24+ ) -> bool :
2325 """Set up ThermoBeacon BLE device from a config entry."""
2426 address = entry .unique_id
2527 assert address is not None
2628 data = ThermoBeaconBluetoothDeviceData ()
27- coordinator = hass .data .setdefault (DOMAIN , {})[entry .entry_id ] = (
28- PassiveBluetoothProcessorCoordinator (
29- hass ,
30- _LOGGER ,
31- address = address ,
32- mode = BluetoothScanningMode .PASSIVE ,
33- update_method = data .update ,
34- )
29+ entry .runtime_data = coordinator = PassiveBluetoothProcessorCoordinator (
30+ hass ,
31+ _LOGGER ,
32+ address = address ,
33+ mode = BluetoothScanningMode .PASSIVE ,
34+ update_method = data .update ,
3535 )
3636 await hass .config_entries .async_forward_entry_setups (entry , PLATFORMS )
3737 entry .async_on_unload (
@@ -40,9 +40,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
4040 return True
4141
4242
43- async def async_unload_entry (hass : HomeAssistant , entry : ConfigEntry ) -> bool :
43+ async def async_unload_entry (
44+ hass : HomeAssistant , entry : ThermoBeaconConfigEntry
45+ ) -> bool :
4446 """Unload a config entry."""
45- if unload_ok := await hass .config_entries .async_unload_platforms (entry , PLATFORMS ):
46- hass .data [DOMAIN ].pop (entry .entry_id )
47-
48- return unload_ok
47+ return await hass .config_entries .async_unload_platforms (entry , PLATFORMS )
0 commit comments