zerotypic / unifi-ble-client

Client for talking to UniFi devices via BLE
GNU General Public License v3.0
0 stars 0 forks source link

G4 Cam Compatibility #2

Open jhelle1 opened 1 month ago

jhelle1 commented 1 month ago

So I was able to get the uuid for my device with that app you shared but I once I went to connect to my G4 cam with the Bluetooth address and uuid I recieved this error: CannotFindDeviceExn: Could not find device with address

This error was in reference to the cams Bluetooth address which im certain is correct, Im not sure if there is something special here regarding the G4s in particular or if Id need to dig into the MTU fix you mentioned under issues, not super familiar with the tech here but if you have any ideas to try Id love to hear them!

Otherwise we can confirm that G4s do not in fact work with the script unfortunately

zerotypic commented 1 month ago

Could you check if the device shows up in bluetoothctl or similar? I'm using the bleak library, which talks to Bluez via dbus under the hood. The scanning phase should be doing the equivalent of what bluetoothctl does. The exception you mention happens early on during the scanning phase, and I think its kind of unlikely that there's some G4-specific incompatibility that's causing problems.

jhelle1 commented 1 month ago

I was able to find the Bluetooth address using blutoothctl and specified the uuid for the G4 camera im attempting to run the script on but I get this:

unifi-ble-client/python/unifi_ble_client.py:629: DeprecationWarning: There is no current event loop loop = asyncio.get_event_loop()

and the script essentially runs forever. Trying to run the script with device specified doesn't seem to work and the uuid crashes it. Any idea what the issue might be?

zerotypic commented 1 month ago

That error seems related to newer versions of Python and how asyncio is handled. I modified the script to manually create an event loop, which should work for now. See if that helps?

jhelle1 commented 1 month ago

Thanks for the fast reply! I was able to get the script to run correctly after your change but unfortunately im now running into another error. It seems the UUID im providing for the G4 device isnt being accepted properly, Ive verified it is correct and tried a handful of different formats but they all seem to return the same error in the end. I apologize if Im bugging you about this but for the sake of documentation I figured id keep updating you, really appreciate your help.

INFO:main:Attempting to connect and authenticate to device. WARNING:main:Exception while running subcommand: OSError(22, 'The parameter is incorrect.', None, -2147024809) ERROR:asyncio:Task was destroyed but it is pending! task: <Task pending name='Task-2' coro=<UnifiBleClient._process_queue() running at C:\Users\infotech\Desktop\github\env\unifi-ble-client\python\unifi_ble_client.py:321> wait_for=>

zerotypic commented 1 month ago

Hmm... this will be more difficult to troubleshoot. One thing you might want to check is if bluetoothd crashed at any point, as that tended to happen quite frequently when I was testing out my G3 (see here for more info). You can check the output of systemctl status bluetooth. If you're seeing crashes, you might need a patched bluetoothd, which unfortunately I haven't had time to put up yet. My patch is also probably not current to the newer versions of Bluez, so it would take some work to create a proper working patch.

Otherwise, it might be some other error, but it is a bit hard to determine based on what you've told me thus far. Not much I can do without an actual device to test on. Sorry!