Adding a Flic bluetooth button via Maker API [tutorial]

Hi all! I'm a Wink refugee. I wanted to share how I got my Bluetooth Flic button working with the Hubitat, since to get it working, I had to reference a couple different help threads. I hope this is the right section of the forum to post this.

Here's my use case. I have two Zigbee outlets in the bedroom, with a bedside lamp plugged into each. Rolling over to manually turn the lights off is dumb, as we all know, so I wanted to mount a small button to the headboard to turn them both off for us.

The Flic price is pretty reasonable if you don't invest in the hub (currently $30 for one button). The caveat is that it has to communicate via Bluetooth. Not a problem in my case because my and my husband's phone or tablet would always be nearby when the Flic is pressed.

Thankfully, Flic can be paired with multiple devices. It will send its commands to whichever one connects first.

Note that you only need local network access for this to work, not an internet or cloud connection.

  1. In Apps, make sure you have Groups and Scenes installed (it's a Built-In App). Create a group for the devices you want to control with the button. In my case, it's the two Zigbee outlets. I called my group "Bedroom Group" (creative, right?).

  2. Next, go to Devices, and click on your new group. If you look at your browser URL, it should be something like this:

http://192.168.X.Y/device/edit/10

The number at the end is your Device ID, in this case, 10. Make note of this number.

Also, look at the Commands. My group has off, on, setColor, setColorTemperature, setHue, setLevel and setSaturation.

These are the things the Flic can tell your group to do.

  1. Go to Apps and install a Maker API. I called mine Flic. I don't think there's really a point in allowing remote access, since your Bluetooth device has to be present for this to work, but you absolutely want to allow access via the local IP address.

  2. Select the new group device, in my case, Bedroom Group.

  3. Scroll down to Local URLs. You'll want to find this one near the bottom:

"Send Device Command (replace [Device ID] with actual subscribed device id and [Command] with a supported command. Supports optional [Secondary value]"

The sample URL here is your template. Now all you have to do is fill in the blanks!

For example...

To turn on the group:
http://192.168.X.Y/apps/api/30/devices/10/on?access_token=big_long_token_string

To turn off the group:
http://192.168.X.Y/apps/api/30/devices/10/off?access_token=big_long_token_string

  1. Open the Flic app on the Bluetooth device it's linked to. Configure each action as an Internet Request. Paste your command URL in the "URL" field, select "GET" as the type, and leave everything else blank. Click Add in the top right to save.

  2. Test your button! I have mine turn the lights off with one click, and turn them back on with a double click. Ultimately, I want press and hold to turn off all the lights in the house -- I just haven't created a group for that yet!

If your button doesn't work, there's probably one of three things wrong. Check if your hub IP address has changed. If so, update the IP address in the command URL. Check if your access token has changed. If so, update the access_token string in the command URL. Check to make sure your phone or tablet is connected to WiFi. If not, connect to the same network that your Hubitat is on.

While Flic does have Wink integration, it was slow and unreliable... pushing the button was kind of a game to see how many times before the lights would do what we were telling them to. With the Hubitat, it's basically instantaneous, and really reliable!

Thank you to the community for all the super cool projects. I've been playing around with them all week. I've had the Hubitat since last September but didn't have the bandwidth to figure it out until recently.

1 Like