1
mirror of https://github.com/home-assistant/core synced 2024-07-15 09:42:11 +02:00

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 GitHub
parent eb01998395
commit dde4217b2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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: