taburineagle / NeewerLite-Python

NeewerLite-Python is an un-official cross-platform Neewer LED light control app - written in Python, originally based off of the NeewerLite macOS Swift project by @keefo (Xu Lian)
MIT License
61 stars 11 forks source link

Raspberry Pi 4 Model B not working #57

Closed markus-seidl closed 2 years ago

markus-seidl commented 2 years ago

Has anyone tried to connect to a Neewer RGB 660 PRO with a Raspberry Pi 4 Model B? I'm able to list the device, but upon connecting it's:

[11:43:25] - Processing HTTP arguments [11:43:26] - Attempting to link to light [NEEWER-RGB660 PRO] MAC Address: D5:5F:37:4E:4E:F2 (Attempt 5 of 6) [11:43:26] - Error linking to light [NEEWER-RGB660 PRO] MAC Address: D5:5F:37:4E:4E:F2 [11:43:30] - Attempting to link to light [NEEWER-RGB660 PRO] MAC Address: D5:5F:37:4E:4E:F2 (Attempt 6 of 6) [11:43:30] - Error linking to light [NEEWER-RGB660 PRO] MAC Address: D5:5F:37:4E:4E:F2

I've added an exception printer, and the "reason" why it's not able to link is:

Device with address D5:5F:37:4E:4E:F2 was not found. It may have been removed from BlueZ when scanning stopped.

After that I've tried it from a Mac with the NeewerLite app and that one worked immediately (so the light should be ok).

Any ideas?

taburineagle commented 2 years ago

Hmm, that's strange - as far as I can recall, I tested NeewerLite-Python on my Pi4 and could connect to the lights I have (which includes the 660PRO), but mine is a Pi4A. What OS are you using? Also, I Googled and found a few results of Pi4s having issues connecting to Bluetooth devices, but I'm not sure if that's what's going on in your case.

I do notice that when looking at my service log ( sudo service bluetooth status) on my Pi4A I get the following errors:

Oct 27 23:12:56 tinygull bluetoothd[745]: Sap driver initialization failed. Oct 27 23:12:56 tinygull bluetoothd[745]: sap-server: Operation not permitted (1) Oct 27 23:13:00 tinygull bluetoothd[745]: Loading LTKs timed out for hci0 Oct 27 23:13:00 tinygull bluetoothd[745]: Failed to set privacy: Rejected (0x0b)

I noticed the SAP plugin mentioned was mentioned in the first link above. That could possibly have something to do with it?

markus-seidl commented 2 years ago

I'm using the newest Raspbian 64 bit (lite) (2022-09-22). I've updated the firmware (rpi-update) but no luck.

I've got the same service log service bluetooth status :

Nov 06 13:17:13 bluez systemd[1]: Started Bluetooth service. Nov 06 13:17:13 bluez bluetoothd[866]: Starting SDP server Nov 06 13:17:13 bluez bluetoothd[866]: Bluetooth management interface 1.21 initialized Nov 06 13:17:13 bluez bluetoothd[866]: profiles/sap/server.c:sap_server_register() Sap driver initialization failed. Nov 06 13:17:13 bluez bluetoothd[866]: sap-server: Operation not permitted (1) Nov 06 13:17:13 bluez bluetoothd[866]: Failed to set privacy: Rejected (0x0b)

I've added the --noplugin=sap as suggested by the first link (another comment states that newer images >2020 worked) but to no avail (same error). And no linkage.

... now hear me out, I ... well it's hardware and software and not some kind of machine ... but...

Then I tried to connect to it with bluetoothctl:

[bluetooth]# scan on Discovery started [CHG] Controller Discovering: yes [NEW] Device AA:BB:CC:DD:EE:FF NEEWER-RGB660 PRO ... [bluetooth]# connect AA:BB:CC:DD:EE:FF Attempting to connect to AA:BB:CC:DD:EE:FF [CHG] Device AA:BB:CC:DD:EE:FF Connected: yes Connection successful [bluetooth]# disconnect AA:BB:CC:DD:EE:FF ...

Then I started the NeewerLite-Python again and it can link. Regardless of the --noplugin=sap setting. I rebooted, works as it should (without manual bluetoothctl connection beforehand).

Weird. Very weird.

Thanks for the help!

taburineagle commented 2 years ago

Very strange indeed - you're welcome @markus-seidl! Glad to hear things worked out - Pis and Bluetooth are apparently kind of a mixed bag as far as I can see on Google. Strangely enough, a Pi setup is the reason I wrote NeewerLite-Python to begin with!

markus-seidl commented 2 years ago

Maybe there can be a troubleshoot.md or a section somewhere so others can try connecting first by hand if it doesn't work? I didn't see this solution on the internet and just found that by luck.

taburineagle commented 2 years ago

That's a good idea - I do want to flesh my documentation out a lot more, I haven't updated it in a while, and some of the things have changed since I last updated it. Operationally most things are the same, but not everything.