Close stale connections (Airthings BLE) (#106748)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Ståle Storø Hauknes 2024-01-03 21:08:58 +01:00 committed by Franck Nijhof
parent 1c94a94ba2
commit aef129afaf
No known key found for this signature in database
GPG key ID: D62583BA8AB11CA3

View file

@ -5,6 +5,7 @@ from datetime import timedelta
import logging
from airthings_ble import AirthingsBluetoothDeviceData, AirthingsDevice
from bleak_retry_connector import close_stale_connections_by_address
from homeassistant.components import bluetooth
from homeassistant.config_entries import ConfigEntry
@ -30,6 +31,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
is_metric = hass.config.units is METRIC_SYSTEM
assert address is not None
await close_stale_connections_by_address(address)
ble_device = bluetooth.async_ble_device_from_address(hass, address)
if not ble_device: