50ButtonsEach / fliclib-linux-hci

Flic SDK for Linux
307 stars 53 forks source link

Button not detected - Using recommended bluetooth adapter #111

Open pollev opened 2 years ago

pollev commented 2 years ago

Hi,

I am currently unable to get my flic buttons to pair with the flic service. I even went as far as to order the exact bluetooth adapter recommended on this page: (Sena Technologies Parani-UD100-G03). There is very little debug options available so I am currently stuck :(. Any advise would be recommended.

I am taking the following steps:

  1. Start the service
  2. Start the simple client
  3. Start the scanning wizard
  4. Click (and hold for 7s) the flic button

Terminal outputs and btmon output attached. Thank you for any help you can give me.

Terminal 1:

sudo /media/warm_storage/home_assistant/flicd/flicd -f /media/warm_storage/home_assistant/flicd/db -s "0.0.0.0" -p 5551 -h hci1
Available HCI devices found:
hci1
hci0

Trying hci1
hci1 is busy, shutting down and retrying...
Successfully bound HCI socket
Flic server is now up and running!
Warning: Bluetooth controller does not support pending connection and scanning at the same time. Will emulate this as good as possible.
Initialization of Bluetooth controller done!
Accepted new client

Terminal 2:

/tmp/flicd/fliclib-linux-hci/simpleclient$ sudo ./simpleclient localhost
Available commands:
getInfo - get various info about the server state and previously verified buttons
startScanWizard - start scan wizard
cancelScanWizard - cancel scan wizard
startScan - start a raw scanning of Flic buttons
stopScan - stop raw scanning
connect xx:xx:xx:xx:xx:xx id - first parameter is the bluetooth address of the button, second is an integer identifier you set to identify this connection
disconnect id - disconnect or abort pending connection
changeModeParameters id latency_mode auto_disconnect_time - change latency mode (NormalLatency/LowLatency/HighLatency) and auto disconnect time for this connection
forceDisconnect xx:xx:xx:xx:xx:xx - disconnect this button, even if other client program are connected
getButtonInfo xx:xx:xx:xx:xx:xx - get button info for a verified button
createBatteryStatusListener xx:xx:xx:xx:xx:xx id - first parameter is the bluetooth address of the button, second is an integer you set to identify this listener
removeBatteryStatusListener id - removes a battery listener
delete xx:xx:xx:xx:xx:xx - delete button
help - prints this help text

startScanWizard
Please click and hold down your Flic button!
Scan wizard done with status WizardFailedTimeout

Terminal 3 (see attached file):

sudo btmon > /tmp/btmon_out

btmon_out.txt

Emill commented 2 years ago

I see that your button is advertising as expected.

Could it be that your button is already added? You can execute getInfo to check that. In that case you can connect to it using connect [xx:x:xx:xx:xx:xx] [id].

Otherwise try to kill bluetoothd so it doesn't "override" flicd.

pollev commented 2 years ago

Hi Emill,

Thank you for your feedback. I can confirm that the button is NOT yet connected. No output from getInfo and it also still flickers red when I press it. The behavior is also identical when I uninstall (or disable) the bluetooth deamon.

Can you suggest another test I could perform to debug this situation?

Emill commented 2 years ago

It's very strange. I've not seen this issue before. Could you potentially try a different Flic button or another computer/dongle? Is the button working in the iOS/Android app?

pollev commented 2 years ago

The button is working as expected when using the app. It connects immediately. (just tried it) I have tried 2 seperate bluetooth dongles, the latter being advertised on this github. Neither seems to allow the button to be detected, though both bluetooth dongles work properly and can detect any other devices if I enable the bluetooth deamon.

I initially wanted to add some debug statements to the library but noticed that it is not open source. So my debugging capabilities are now limited to asking for your support. Any other recommendations to try? Are there any verbose flags I could enable to get to the bottom of this?

Emill commented 2 years ago

I guess you tried deleting the database file and restart flicd?

pollev commented 2 years ago

I had not tried deleting the db file. But I just tried and same result sadly :/

pollev commented 1 year ago

Hi Emill, any other debugging you can advise me. I was really hoping to actually get to use these buttons :(

treegartner commented 1 year ago

Have you tried using another implementation? When I was setting up the fliclib, I used the python implementation, which worked quite well.

# start the service as usual (in my case) !! do you use the correct version for your system e.g. armv6l or x86_64?
~/dev/fliclib-linux-hci/bin/armv6l/flicd -d -f ~/.flic/buttons.db
# start the testclient in python
python3 ~/dev/fliclib-linux-hci/clientlib/python/test_client.py
# in another terminal (or screen) i start the scan wizard
python3 ~/dev/fliclib-linux-hci/clientlib/python/scan_wizard.py

One thing I stumbled upon was, that I need a working internet connection for whatever reason to connect the button. So therefore you might also check network, proxy and firewall settings.

Hope that helps a bit, getting a step closer to your solution.