hardillb / node-red-contrib-flic-buttons

17 stars 9 forks source link

node-red-contrib-flic-buttons

A Node-RED node to interact with the flic.io BLE buttons.

Installing Flic Daemon

This node requires the fliclib-linux-hci daemon to handle the low level comunication with the buttons. You will need to install this before you start:

git clone https://github.com/50ButtonsEach/fliclib-linux-hci.git

you can either start the daemon manually:

cd bin/armv6l/
sudo ./flicd -f flic.sqlite3

or you can edit /etc/rc.local to start the daemon on boot:

sudo nano /etc/rc.local

Add the following line just before the exit 0:

sleep 10 &&  /home/pi/git/fliclib-linux-hci/bin/armv6l/./flicd -d -l /var/log/flic.log  -f /home/pi/git/fliclib-linux-hci/bin/armv6l/flic.sqlite3 &

(obviously change the paths to match where you have installed)

Pairing Buttons

Buttons need to be paired before you can use this node at the moment. We do this using the scanwizard.js located in the lib folder.

Adding Buttons to Node-Red

Each flic node requires you specify a button and a click type. The button is configured with a configuration node that can be shared amounst multiple flic nodes. For example one Living Room button might be configured but one node will use the SingleClick event and another will use the Hold event.

The button config node takes the following parameters:

The node emits a msg.payload that looks like this

{
  "deviceId":"80:E4:DA:70:XX:XX",
  "queued":true,
  "timeDiff":0,
  "clickType":"ButtonDown"
}

ClickType can be: ButtonDown,ButtonUp,ButtonClick,ButtonSingleClick,ButtonDoubleClick,ButtonHold.