Skip to content

How to deal with sleep/wake issues -- wifi timeout errors, handler errors, timeout errors #16

Description

@leeprevost

I'm using mostly the video.py code to build a "take_video" function which takes 5 seconds of video and returns a file name.

This works most of the time ....

But, I've found several edge cases that seem to be related to when the gopro goes to sleep or when the gopro is turned off where I encounter errors or warnings. Example 3 maybe related to manually changing back to local wifi rather than camera wifi and then re-running script.

OS: Windows10

(Much thanks to the authors for the incredible video.log capability)

Example 1 (unhadled notification):

     data:   bleak.backends.dotnet.client:  437 11:29:37.031 DEBUG    | Get Services...
     data:   bleak.backends.dotnet.client:  437 11:29:37.031 DEBUG    | Get Services...
     data:   bleak.backends.dotnet.client:  554 11:29:37.486 INFO     | Services resolved for BleakClientDotNet (F5:A2:15:A9:A4:F7)
     data:   bleak.backends.dotnet.client:  554 11:29:37.486 INFO     | Services resolved for BleakClientDotNet (F5:A2:15:A9:A4:F7)
     data:      open_gopro.ble_controller:  157 11:29:37.486 DEBUG    | Attempting to pair...
     data:      open_gopro.ble_controller:  163 11:29:37.486 DEBUG    | Pairing complete!
     data:      open_gopro.ble_controller:  164 11:29:37.486 INFO     | BLE Connected!
     data:      open_gopro.ble_controller:  175 11:29:37.486 INFO     | Enabling notifications...
     data:      open_gopro.ble_controller:  179 11:29:37.486 DEBUG    | Enabling notification on char 00002a19-0000-1000-8000-00805f9b34fb
     **data:               open_gopro.gopro:  424 11:29:37.670 WARNING  | Unhandled notification from handle 15**

Example 2 (Bluetooth timeout error):

     data:      open_gopro.ble_controller:  163 11:25:02.008 DEBUG    | Pairing complete!
     data:      open_gopro.ble_controller:  164 11:25:02.008 INFO     | BLE Connected!
     data:      open_gopro.ble_controller:  175 11:25:02.008 INFO     | Enabling notifications...
     data:      open_gopro.ble_controller:  179 11:25:02.008 DEBUG    | Enabling notification on char 00002a19-0000-1000-8000-00805f9b34fb
 Dummy-65:   bleak.backends.dotnet.client:  215 11:25:16.023 DEBUG    | _ConnectionStatusChanged_Handler: 0
 Dummy-65:   bleak.backends.dotnet.client:  215 11:25:16.023 DEBUG    | _ConnectionStatusChanged_Handler: 0
     data:      open_gopro.ble_controller:   33 11:25:16.023 DEBUG    | On device BleakClientDotNet (F5:A2:15:A9:A4:F7), Disconnected callback called!
 MainThread:               open_gopro.gopro:  408 11:25:16.041 WARNING  | BleakError('Could not start notify on 00002a19-0000-1000-8000-00805f9b34fb: Unreachable'). Retrying #1
      data:      open_gopro.ble_controller:  144 11:25:16.046 INFO     | Establishing BLE connection to F5:A2:15:A9:A4:F7: GoPro 2659...
      data:   bleak.backends.dotnet.client:  164 11:25:16.046 DEBUG    | Connecting to BLE device @ F5:A2:15:A9:A4:F7
      data:   bleak.backends.dotnet.client:  164 11:25:16.046 DEBUG    | Connecting to BLE device @ F5:A2:15:A9:A4:F7
  Dummy-66:   bleak.backends.dotnet.client:  215 11:25:17.057 DEBUG    | _ConnectionStatusChanged_Handler: 1
  Dummy-66:   bleak.backends.dotnet.client:  215 11:25:17.057 DEBUG    | _ConnectionStatusChanged_Handler: 1
      data:   bleak.backends.dotnet.client:  437 11:25:17.057 DEBUG    | Get Services...
      data:   bleak.backends.dotnet.client:  437 11:25:17.057 DEBUG    | Get Services...
  MainThread:               open_gopro.gopro:  408 11:25:17.226 WARNING  | BleakDotNetTaskError('Could not get GATT characteristics for Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService: AccessDenied'). Retrying #2
      data:      open_gopro.ble_controller:  144 11:25:17.242 INFO     | Establishing BLE connection to F5:A2:15:A9:A4:F7: GoPro 2659...
      data:   bleak.backends.dotnet.client:  164 11:25:17.242 DEBUG    | Connecting to BLE device @ F5:A2:15:A9:A4:F7
      data:   bleak.backends.dotnet.client:  164 11:25:17.242 DEBUG    | Connecting to BLE device @ F5:A2:15:A9:A4:F7
    MainThread:               open_gopro.gopro:  408 11:25:32.392 WARNING  | TimeoutError(). Retrying #3
      data:      open_gopro.ble_controller:  144 11:25:32.392 INFO     | Establishing BLE connection to F5:A2:15:A9:A4:F7: GoPro 2659...
      data:   bleak.backends.dotnet.client:  164 11:25:32.392 DEBUG    | Connecting to BLE device @ F5:A2:15:A9:A4:F7
      data:   bleak.backends.dotnet.client:  164 11:25:32.392 DEBUG    | Connecting to BLE device @ F5:A2:15:A9:A4:F7
   MainThread:               open_gopro.gopro:  408 11:25:47.544 WARNING  | TimeoutError(). Retrying #4

Example 3 (wifi connection timeout -- several tries but never connects to wifi, ends with this in log):

MainThread:     open_gopro.wifi_controller:  897 11:38:14.536 DEBUG    | Waiting 1 second for Wi-Fi connection to establish...
keep_alive:        open_gopro.ble_commands:  350 11:38:58.733 INFO     | <----------- set : LED.BLE_KEEP_ALIVE
keep_alive:               open_gopro.gopro:  540 11:38:58.733 DEBUG    | SettingId.LED acquiring semaphore
keep_alive:               open_gopro.gopro:  542 11:38:58.733 DEBUG    | SettingId.LED has semaphore
      data:      open_gopro.ble_controller:   72 11:38:58.733 DEBUG    | Writing to b5f90074-aa8d-11e3-9046-0002a5d5c51b: 03:5b:01:3d
      data:   bleak.backends.dotnet.client:  716 11:38:58.737 DEBUG    | Write Characteristic b5f90074-aa8d-11e3-9046-0002a5d5c51b : bytearray(b'\x03[\x01=')
      data:   bleak.backends.dotnet.client:  716 11:38:58.737 DEBUG    | Write Characteristic b5f90074-aa8d-11e3-9046-0002a5d5c51b : bytearray(b'\x03[\x01=')
      data:               open_gopro.gopro:  427 11:38:58.962 DEBUG    | Received response on UUID.CQ_SETTINGS_RESP: b'02:5b:00'
keep_alive:               open_gopro.gopro:  574 11:38:58.962 DEBUG    | SettingId.LED released the semaphore
keep_alive:        open_gopro.ble_commands:  362 11:38:58.962 INFO     | -----------> 
{
 "status": "SUCCESS",
 "id": "UUID.CQ_SETTINGS_RESP::SettingId.LED"
}

Question: is there a guide to properly wake up? Could this be related to how windows handles a device that is already paired and then atempting to re-pair to the device upon waking it? I noticed in source, there are some references to a todo "make robust" -- I wonder if this is what I'm running into?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions