Flic not pairing to Raspberry Pi 3 using Node.js
Sawtaytoes opened this issue · 4 comments
I'm trying to get a Flic paired to the Raspberry Pi 3 by using the newer fliclib-linux-hci SDK and Node.js.
I'm running Ubuntu 16.04 LTS and Node.js 8.1.2 (I also tried 6.11.0 and had the same issue).
For testing purposes, I was able to run the server on my Raspberry Pi
> ./bin/armv6l/flicd -f flic-db.sqlite3 -w -s 0.0.0.0
Available HCI devices found:
Trying hci0
Flic server is now up and running!
Accepted new client
I was able to get connected both in another terminal on the Raspberry Pi and through Windows by running the Node.js app.
> node newscanwizard.js
Welcome to the add new button wizard. Press your Flic button to add it.
Every time I press the Flic, it has a red LED. What's the trick to getting this working?
I assume it works well when you try connect it to a smartphone?
Anyway, start "sudo btmon" in another terminal on the Pi, start the flicd and try to add a button. Could you then post the full output of btmon?
It wasn't able to do anything. Apparently there are Bluetooth issues with Ubuntu 16.04 and the Raspberry Pi. I completely rebuilt the entire system with Raspbian Lite, and it connected this time:
> ~/fliclib-linux-hci-master $ sudo ./bin/armv6l/flicd -f flic-db.sqlite3 -w -s 0.0.0.0
Available HCI devices found:
hci0
Trying hci0
Flic server is now up and running!
HCI socket busy, bringing down and then retrying
Successfully bound HCI socket
Initialization of Bluetooth controller done!
Accepted new client
Client EOF
A client was disconnected
Accepted new client
> ~/fliclib-linux-hci-master $ node clientlib/nodejs/newscanwizard.js
Welcome to the add new button wizard. Press your Flic button to add it.
Found public button 00:00:00:00:00:00 (A000aa0a). Now connecting...
Button connected. Now verifying and pairing...
Completed with result: WizardSuccess
Your new button is 00:00:00:00:00:00
> ~/fliclib-linux-hci-master $ node clientlib/nodejs/example.js
Connected to daemon!
00:00:00:00:00:00 Connected
00:00:00:00:00:00 Ready
00:00:00:00:00:00 ButtonDown wasQueued 8677 seconds ago
00:00:00:00:00:00 ButtonUp wasQueued 8677 seconds ago
G'day @Sawtaytoes,
I have a Homebridge plugin for Flic that is using Node.js successfully, however, I am not using the newscanwizard.js
instead I'm using FlicScanner
.
You might have more success with using that.
You can check out the code here...
https://github.com/devbobo/homebridge-flic/blob/master/index.js#L124
Hope that helps.
David
Thanks for the tip @devbobo!