File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -256,7 +256,7 @@ def _reset_disconnect_timer(self):
256256 self ._cancel_disconnect_timer ()
257257 self ._expected_disconnect = False
258258 self ._disconnect_timer = self .loop .call_later (
259- DISCONNECT_DELAY , self ._disconnect
259+ DISCONNECT_DELAY , self ._disconnect_from_timer
260260 )
261261
262262 def _disconnected (self , client : BleakClientWithServiceCache ) -> None :
@@ -272,8 +272,16 @@ def _disconnected(self, client: BleakClientWithServiceCache) -> None:
272272 self .rssi ,
273273 )
274274
275- def _disconnect (self ):
275+ def _disconnect_from_timer (self ):
276276 """Disconnect from device."""
277+ if self ._operation_lock .locked () and self ._client .is_connected :
278+ _LOGGER .debug (
279+ "%s: Operation in progress, resetting disconnect timer; RSSI: %s" ,
280+ self .name ,
281+ self .rssi ,
282+ )
283+ self ._reset_disconnect_timer ()
284+ return
277285 self ._cancel_disconnect_timer ()
278286 asyncio .create_task (self ._execute_timed_disconnect ())
279287
You can’t perform that action at this time.
0 commit comments