Lifx Group of Groups Driver (ST port)



@stephack Is there any way to control Lifx lights independently? Also do I have to make a Vitrual Devices for each groups of light?


This was really designed to remove the need for linking lights individually but it will probably work if you type in the bulb name instead of the group. I haven't tried it but it might work.

Yes, you would have to create a virtual device for every group/bulb you want to control. The benefit of this driver is that you can have bulbs in multiple groups.
Kitchen Lights - would include all the bulbs in the kitchen
Downstairs lights - would include all lights that are downstairs...including the kitchen lights. Options are endless.


@stephack Thanks for the info.


Thanks for this port.

I'm wondering how feasible it would be to get it to recognize hex colors by converting hex to hsl. I found in another thread Todd Wackford suggesting using some conversions from his Fibaro RGBW Controller DTH:

The conversions should start at line 233, and looks to cater to hex values, color names, and variations thereof.


I planned to update this driver back to async http calls like it was originally designed...but I have been pretty busy lately and use what time I have working on other automations.....when I have some more free time and decide to update this driver I'll do my best to incorporate this for you as well. I have a feeling it might be more complicated than it appears at first glance (as was the case with most of this port).


Just throwing out ideas - I will take a look also and see if I can get a rudimentary handle on groovy here.


Hi there,

I have been talking with Bobby about some issues I have been having with Lifx downlights and he suggested make a post here as well.

My set up - HE hub, 6 Lifx downlights, Xiaomi motion sensors, Google Wifi router, using Webcore and Motion Lighting. Distance of lights to hub is only about 10m if that.

So I have the motion sensors set up in few rooms to pretty much turn lights on when motion is detected. In some rooms I have this set up with Hue lights and Seglend, they come on right away however with Lifx lights I am getting a massive delay of about 3 to 4 seconds. Below is the log from one of them.

|+1ms|╔Received event [Guest Bedroom Motion Sensor].motion = active with a delay of 368ms|
|+262ms|║RunTime Analysis CS > 159ms > PS > 68ms > PE > 34ms > CE|
|+287ms|║Runtime (48787 bytes) successfully initialized in 68ms (v0.3.107.20180806) (275ms)|
|+289ms|║╔Execution stage started|
|+294ms|║║Comparison (enum) active changes_to (string) active = true (1ms)|
|+299ms|║║Cancelling condition #2's schedules...|
|+301ms|║║Condition #2 evaluated true (9ms)|
|+307ms|║║Comparison (time) 80340671 is_between (time) 79200000 .. (time) 25200000 = true (3ms)|
|+309ms|║║Time restriction check passed|
|+311ms|║║Cancelling condition #5's schedules...|
|+313ms|║║Condition #5 evaluated true (10ms)|
|+314ms|║║Cancelling condition #1's schedules...|
|+319ms|║║Condition group #1 evaluated true (state changed) (26ms)|
|+320ms|║║Cancelling statement #3's schedules...|
|+4507ms|║║Executed physical command [Guest Bedroom Light].setLevel([25]) (4179ms)|
|+4509ms|║║Executed [Guest Bedroom Light].setLevel (4182ms)|
|+10318ms|║║Executed physical command [Guest Bedroom Light].setColor([[hex:    #FAEBD7, hue:9, saturation:78, level:91]]) (5798ms)|
|+10320ms|║║Executed [Guest Bedroom Light].setColor (5803ms)|
|+10385ms|║║Comparison (time) 80350691 is_between (time) 1536660360000 .. (time) 79140000 = false (2ms)|
|+10387ms|║║Cancelling condition #20's schedules...|
|+10388ms|║║Condition #20 evaluated false (66ms)|
|+10390ms|║║Cancelling condition #19's schedules...|
|+10391ms|║║Condition group #19 evaluated false (state changed) (69ms)|
|+10396ms|║║Comparison (enum) active stays (string) inactive = false (1ms)|
|+10398ms|║║Cancelling any timed trigger schedules for condition 15|
|+10400ms|║║Cancelling statement #15's schedules...|
|+10402ms|║║Cancelling condition #15's schedules...|
|+10404ms|║║Condition #15 evaluated false (10ms)|
|+10406ms|║║Cancelling condition #14's schedules...|
|+10408ms|║║Condition group #14 evaluated false (state changed) (14ms)|
|+10435ms|║╚Execution stage complete. (10146ms)|
|+10479ms|╚Event processed successfully (10479ms)|

Can see motion is picked up quick but the turning the lights on is when it gets hung up. If I use the app it comes on quick, I have also used a hue motion sensor with same delay.

I'am not too sure what else to try and I have not really found anyone else with this issue :confused:
I also contacted Lifx support but they are saying it's a Hubitat problem and not their lights, which I suppose is sort of true as through the app works fine.

Any help would be really appreciated as where these lights are I am really only in the room for a few seconds so having this delay sort of makes them pointless.


Chatting with bobby. Will PM you shortly.


Hey @stephack - I'm wondering about the debug settings in the driver. It pushes a '200' info every 60 seconds to the logs for each bulb:


It's not harming anything, but I just happened to notice since it's so talkative. Is this relaying from the LIFX api?


Yes, its refreshing the bulb states in case it is updated outside of HE. The 200 means it retrieved the settings successfully.


@stephack I using your driver for my Lifx light and try to set up HSM with the lights flashing but keep getting an error that flash is not supported is there a way to make these flash? Thanks

2018-10-28 11:11:46.290:errorjava.lang.IllegalArgumentException: Command 'flash' is not supported by device. (waterHandler)


This is almost a direct port from the ST app. The flash() method is strictly HE. It can be added but this driver was a real PITA to convert to HE. I started to add the built in pulse and flash and a few other bits of code but it got unnecessarily complicated fast and I stopped working on it since the basics were there.

HE has since added a few of the problematic functions so I'll give it a shot again, but I can't guarantee much as I don't plan to devote much more time on this driver...especially if it's still as painful as it was originally.


@stephack that ok instead of the flash I just use the turn on until it clears. I didn't know how much trouble it would, thanks for the reply. I like the app and I was just wondering how hard it would be and just wish I knew how to write code myself. Thanks again.


It's worth a shot. I'm just trying to figure out how the flash method is supposed to work so I can mimic it. There is already a method call ApiFlash in the Lifx driver that flashes for about 5 seconds. I'm not sure how the built in flash() method is designed to work.


So I tested on my Bathroom lights (ge dimmer and the only lights in my house that support flash). It looks like the flash() method calls on and off indefinitely till the light receives an on() or off() command. I don't think there is a way to make the lifx flash indefinitely. I believe you need to set the number of cycles. You probably don't want this to occur indefinitely anyway because you'll might get black listed by the Lifx api for too many calls. It's probably better this is done with a custom command where you can limit the cycles...maybe over the course of a minute or 2. Anything more than that, and chances are you are not home to see the lights flash anyway....agreed?


@stephack I agree with that but I also will turn lights off and not set to flash if away and not run for more than a minute or so, but I kind of like just turning on the lights to a color and that way i know something is wrong and will look around to see what is going on. Thanks to you for looking at this. This community is great. Thanks again but after rethinking it turning the light on to a different color works for me.


Well in case you change your mind...I created a custom command in the RM app.
The first parameter is an integer that represents the number of cycles.
The second parameter is a decimal that represents the total time of the cycle.

So the above would flash 60 times with each flash taking 1 second to complete...flashes for 1 minute.
Increase parameter 1 for more flashes. Increasing parameter 2 would have the light flash slower and decreasing would make the light flashes faster.

You can also do an apibreathe() with similar parameters to make the lights fade on and off (breathe) instead.


@stephack Hey I appreciated what you are doing can you explain how you did that or did you change the app? Thanks


I didn't make any changes to the Lifx driver. The apiFlash command is already part of it. In Rule Machine there is an option to Create a Custom Command. This let's you use commands that are part of third party drivers in Rule Machine. Give it a shot and let me know if you have any specific questions.