Appium Could not find online devices (Encountered internal error running command: Error: Could not find a connected Android device)

Have the same problem. Appium, Windows, Android. Devices paired via Wi-Fi. All works well until the device reconnected. E. g. after I come back to the Wi-Fi zone I check adb devices (there is nothing) then adb connect (connected to 192.168.1.2:5555), then run my script and Appium fails with

  File "path\main.py", line 64, in __enter__
    self.driver = webdriver.Remote(self.appium_server_url, options=options)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "path\venv\Lib\site-packages\appium\webdriver\webdriver.py", line 229, in __init__
    super().__init__(
  File "path\venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 208, in __init__
    self.start_session(capabilities)
  File "path\venv\Lib\site-packages\appium\webdriver\webdriver.py", line 320, in start_session
    response = self.execute(RemoteCommand.NEW_SESSION, w3c_caps)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "path\venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 347, in execute
    self.error_handler.check_response(response)
  File "path\venv\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not find a connected Android device in 20000ms
Stacktrace:
UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not find a connected Android device in 20000ms
    at getResponseForW3CError (/usr/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/errors.js:1145:9)
    at asyncHandler (/usr/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/protocol.js:485:57)

re-pairing solves the issue, but I think this is not the way it should work