LIFX Local Control

I find that for a single device it's virtually instantaneous 100% of the time so far, but you're right about multiple devices. Not sure if I can do much about that, there's a lot going on in the background.

It would be nice to have a high resolution timer available to work out how long it takes to build a packet. Then I could perhaps see if it's worth caching the packets for a given command and payload rather than rebuilding them every time.

I'm sure there must be something undocumented that happens with the HTTP API to allow a group to be treated as one device.

It's possible that UDP packets are occasionally being lost I suppose. I request an acknowledgement for each packet that modifies state, if another packet is sent (such as polling for the state of the device) before the ack is received then it will attempt to resend the previous packet just once. But I would expect that to take potentially up to a minute, rather than just 5 seconds.

seems like a good idea for the roadmap!

1 Like

I'd recommend holding off until tomorrow at least - I've made some changes to the discovery process, it now discovers all my devices in the first pass, over 95% of the time. I need to make a few more tweaks, but it seems pretty solid - going to try it on my new spare hub tomorrow though (and make sure that it works when you have two hubs as well).

1 Like

Okay, the github repo is updated with better discovery, and a new LIFX White driver in addition to the LIFX White Mono driver.

2 Likes

And a quick fix for bad parsing of the colour map (including the colour temperature). Should only require an update of the LIFX Master app

Rob, I'm in your debt. Thank you so much for creating and maintaining this control!

1 Like

I'm hoping to be able to get the multizone driver working this weekend, but no promises.

Rob, do you know if it's possible to activate LIFX scenes using Hubitat?

Currently I'm using a Samsung SmartThings button to control 4 lights in my family room. Push sets the lights to 70% brightness and color temp 2000. Double-push sets them to 0% brightness (essentially turns them off). Holding the button sets the lights to 100% brightness and color temp 3500. The problem is that whenever I perform any of these actions, it cycles through each light first to set the brightness for each light and then again to set the color temp for each light. This results in a weird "musical chairs" effect. However, when I'm using Google Home I can simply tell it to activate a specific LIFX scene, which sets the brightness and color temps for all 4 lights all at once. <wishing, dreaming> :slightly_smiling_face:

The same thing applies when using the LIFX Skill on the Amazon Echo.

You can use SetColor with [level:100, saturation:0, kelvin: 3500] - use a custom command in Rule Machine to do that. It will only apply to one bulb at a time, but will set all the parameters in one action.

Thanks, Rob. This is my first time using custom commands, and I must be doing something wrong because I can't get setColor to work correctly. I'm assuming it should be that parameter 1 is type string and the value is "level:100, saturation:0, kelvin: 3500". Am I doing something wrong?

BTW, all other searches on the setColor command has been fruitless.

You need to put it in square brackets for it to be treated as a map. Probably inside the string.

Hmmm, it's not working for SetColor - it should work for SetState, but that doesn't currently cope with the colorTemperature.

I'll try to add that tomorrow.

Thanks for confirming I'm not crazy :wink: and thanks for trying to help! :smile:

In the meantime if you can find a suitable colour that matches the colourTemperature you want, then you could use setState with '[brightness: 100, color: "#FFEEEE"]' for example, replace the hex code with a suitable colour.

I had to use "level" instead of "brightness", and in order to turn them on after they've been turned off I had to add 'power: "on"' as well.

So here's what I have:

button pushed = comfy lights = '[level: 60, color: "FFEEEE", power: "on"]'
button held = bright lights = '[level: 100, color: "FFFFFF", power: "on"]'
button double-tapped = lights off = '[level: 1, color: "FFEEEE", power: "off"]'

I added the level 1 to the off setting because going from bright to off to comfy turned the comfy lights on at bright white before setting to comfy. Weird but it seems to work.

Thanks so much for this help in the meantime!!

New version released just now.

This one definitely requires all drivers to be updated along with the app.

Notes:
Split the app's page into multiple pages - discovery is now on its own page which allows for more frequent refreshes.

Discovery improvements - for me it reliably discovers all devices in 2 passes

SetState now takes the following parameters in the map

  • brightness
  • level (same as brightness if a colour is specified)
  • color (or colour). This can be a named colour, an HTML colour specified in hex e.g. #FF77DC or 'random' which will pick a colour from the named colours
  • power - on or off
  • kelvin (or temperature)
  • duration (in seconds, the duration for the transition to the new state, can be a decimal value)

Added new Named Colors page which shows the available named colours. The colors can be sorted by Name, Hue, Level or RGB. There are more named colours now, and a lot more to add in future.

Discovered devices are now shown as links which will take you directly to that device's page in a new browser tab.

Please ignore the 'For experimental Stuff' page, it's currently broken - I'd meant to disable it.

1 Like

Sweet!! I'm going to try it out as soon as possible. :smile:

1 Like

Rob, I've been playing around with this and I found a defect on line 652 of LIFXMasterApp that triggers when trying to use a named color instead of hex. Seems like it's defining a new private foundColor that's not available outside the IF statement. I modified it to the following and now the named color feature works. Hopefully I didn't break something else.

	foundColor = colorList().find { (it.name as String).equalsIgnoreCase(color) }

I'll continue to test out the rest.

Thanks again for all your work! I'm loving it! :smile: