mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Update switchbot to use close_stale_connections_by_address (#106835)
This commit is contained in:
parent
584b6c2862
commit
9231e00561
@ -98,6 +98,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
# connectable means we can make connections to the device
|
||||
connectable = switchbot_model in CONNECTABLE_SUPPORTED_MODEL_TYPES
|
||||
address: str = entry.data[CONF_ADDRESS]
|
||||
|
||||
await switchbot.close_stale_connections_by_address(address)
|
||||
|
||||
ble_device = bluetooth.async_ble_device_from_address(
|
||||
hass, address.upper(), connectable
|
||||
)
|
||||
@ -106,7 +109,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
f"Could not find Switchbot {sensor_type} with address {address}"
|
||||
)
|
||||
|
||||
await switchbot.close_stale_connections(ble_device)
|
||||
cls = CLASS_BY_DEVICE.get(sensor_type, switchbot.SwitchbotDevice)
|
||||
if cls is switchbot.SwitchbotLock:
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user