npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-red-contrib-flic-buttons

v1.1.1

Published

A Node-RED node to inject events from flic buttons

Downloads

46

Readme

node-red-contrib-flic-buttons

A Node-RED node to interact with the flic.io BLE buttons. Originally created by hardilib, this is actually a fork from osos's version, which added an option for auto-disconnect timeout to save battery life in the Flic buttons.

This fork includes two major upgrades:

  • Auto-reconnect to the server. If your flicd server restarts, the node will reconnect and reattach all connection channels, without missing a beat.
  • Multiple events can be triggered from one node.

See change log for full details.

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.

  • Ensure that the daemon are running
  • Ensure that any phones or other devices that your flic buttons were previously paired with are switched off or have bluetooth disabled
  • navigate to node-red-contrib-flic-buttons/lib
  • type the command node scanwizard.js
  • press your flic button
  • If it has previously been paired to another device you will have to hold the flic button down for 7 seconds to put it into public mode
  • once paired take a note of the bluetooth address
  • repeat this for all your flic button noting down the address for each button

Adding Buttons to Node-Red

Each flic node requires you specify a button and at least one click type. The button is configured with a configuration node that can be shared amounst multiple flic nodes.

The button config node takes the following parameters:

  • Host - this is the host running the flic.io daemon process, defaults to localhost
  • Port - the port for the daemon process, defaults to 5551
  • Button Address - the bluetooth address that you noted down when pairing your buttons

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 - triggered as soon as the button is pressed, regardless of single, double, or hold. (Note: will trigger twice during a double click operation)
  • ButtonUp - triggered as soon as the button is released, regardless of single, double, or hold. (Note: will trigger twice during a double click operation)
  • ButtonClick - triggered after the button is released and was held for at most 1 second
  • ButtonSingleClick - triggered after the button is clicked once
  • ButtonDoubleClick - triggered after the button is clicked twice (time between clicks is at most 0.5 seconds)
  • ButtonHold - triggered immediately once the button is held for at least 1 second