Saturday, December 12, 2015

Control a Lifx Bulb using Flic and Tasker

This is documentation on how I made Flic[1] control a Lifx bulb[2] on my local network WITHOUT requiring an internet connection.

I don't want to expose my Lifx bulb to the internet. (That's a discussion for another time and place). but, I wanted to use the Flic button to control my bulb. Here's how I made it work

Hardware Pre-requisites:

  1. A Flic button [1]
  2. A Lifx bulb [2]

Requirements:

  1. Android 4.4 or newer device. (I'm using a Nexus 4)
  2. Tasker [3]
  3. Lifx Plugin for Tasker [4]

Why:

The built in method of making Flic control a Lifx bulb is the following.

Push button -> Talks to Flic app on phone -> Talks to Flic server -> Talks to Lifx Server -> Talks to your Lifx Bulb
This requires too much internet access for my comfort. I wanted something that did not depend on the Internet to work.

How to configure it

  1. Install the Lifx plugin for Tasker.
  2. It will give you a very simple app outside of Tasker that allows you to perform the basic operations to your bulb. Make sure this works before continuing. I spent quite a bit of time before I figured out this part.
  3. Create a Tasker - Task (I named this LIFX-ON)
    1. Choose plugin -> Lifx tasker plugin
    2. Setup whatever you want it to do. I configured it to turn on my bulb)
  4. Open the Flic app - DELETE any existing actions. (this is important, otherwise, the programmed action seems to take precedence over the notification to Tasker).
  5. Close the Flic app.
  6. Return to Tasker - create a new profile (credit: [5])
    1. Profile -> Context -> Event -> Plugin : Flic
    2. Choose the flic button, and choose your event. ( I selected ON).
  7. Done.

How it works

  1. Push the Flic button
  2. This talks to the Flic app over BLE
  3. The Flic app notifies Tasker that the button was pushed.
  4. Tasker executes your Lifx ON task
  5. Your bulb should now turn ON.

I've also created another event, this time for double click to Turn OFF the Lifx Bulb.

Hope this helps someone.

[1]Flic : https://flic.io/
[2]Lifx: https://www.lifx.com/
[3]Tasker : https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm&hl=en
[4] Lifx Plugin for Tasker: https://play.google.com/store/apps/details?id=org.timothyb89.lifx.tasker
[5] http://ideas.flic.io/forums/283403-flic-ideas/suggestions/7177881-integrated-with-tasker-the-automation-app

4 comments:

Shanness said...

Thank you!! This is great! The only problem, and it's a significant one is that it fails if my phone is locked :( Any ideas? The flic gets the signal (the phone beeps), and the tasker run logs look right, but it's failing? Perhaps wifi is disabled when the phone screen is off? Galaxy S8 running Android 7. Any ideas? I've tried "say"ing %myTRUSTEDWIFI, but it's always true, even when this fails.

Shanness said...

Also, I don't suppose you've figured out a way to pass the flic button name or something into the tasker task, to avoid lots of repetition of tasks? (i.e. would be great to use a variable and if statements)

Shanness said...

Damn, the flic tasker plugin seems completely broken? It only seems to support one button. When I add a profile for another button it breaks the first. And if I try to fix it, it swaps them. i.e. the Run Log shows that I pressed the "lounge room" button, but I pressed the bedroom one, and when this happens, the lounge one stops triggering anything in tasker :( Is this still working for you?

Suneil said...

Unfortunately no. I stopped using this setup after a few months - for multiple issues - locked phone was one of them. The other was that my phone woulnd't stay paired. Wifi or BT being turned off with your screen could be a factor.

I eventually gave up on both flic and Lifx. Neither eco-system was stable for my setup. Lights need to be 100% reliable. I couldn't stand the 95% reliability.