LifxCMD – Control your Lifx Bulbs from the command line

lifx

Update: I will no longer be continuing development on any LIFX modules or applications. Sorry guys..
As much as I like what LIFX bulbs could ‘potentially’ do; LIFX, as a company, are lazy, don’t support their customers and don’t even bother to reply to people on their forums but then expect you to pay over $100 for a singular bulb that barely works.

Their IOS/Android applications work sometimes, most days the bulbs need to be turned off and on so that they reconnect to your Wifi network to actually start working.

Overall just a really shitty experience and would not recommend them to anyone.

I have a few Lifx Bulbs from Lifx Labs which are a pretty awesome (well when they stay connected to the wifi network – which hopefully they’ll fix soon with an update) wifi connected multi-coloured lightbulb which can be controlled from your smartphone. Spiffy.

Being from Australia I love to support other Australian Technology companies who are trying to build innovative products. These things are great if you are thinking about replacing a room/lamp/office with a set of led lightbulbs with multi-color support.

For anyone that already has Lifx bulbs let me introduce you to LifxCMD – a command line tool to control your Lifx bulbs.

Very similar to my existing tools IncontrolCMD & WemoCMD this utility allows you to call one, or many bulbs, and set them to a specific colour.

LifxCMD.exe --list
List all bulbs found on the network.

LifxCMD.exe --poll
Poll for bulbs every 5 seconds and show them on screen.

To control a bulb you can select it by name or ip address. Multiple bulbs can be separated by commas. Names with spaces need to be enclosed in quotation marks.

LifxCMD.exe --name "Lounge Room","Bedroom Lamp",Lamp1,192.168.1.41

Couple this with one, or all, of the following options:

--brightness [0 to 65525 or 0%-100%]
Set a bulb(s) brightness between 0 and 65525 or as a percentage e.g. 50%

--hue [0 to 65525]
Set a bulb(s) hue between 0 and 65525.

--saturation [0 to 65525]
Set a bulb(s) saturation between 0 and 65525.

--kelvin [2500 to 10000]
Set a bulb(s) kelvin between 2500 and 10000.

Some optional options:

--transition [milliseconds]
Set a bulb(s) transition to the defined color in milliseconds. e.g. 50000 will trasition to the defined colour over 50 seconds.

--colour [system.drawing.color]
Set a bulb(s) to a System.Drawing Color e.g. AliceBlue, Green, LightBlue.
A list of System.Drawing Colors can be found here.

--rgb [r,g,b]
Set a bulb(s) RGB Color separated by commas e.g r,g,b.

Example

Let’s set the ‘Lounge Lamp’ bulb to AliceBlue over 30 seconds:
LifxCMD.exe --name "Lounge Lamp" --colour AliceBlue --transition 30000
or shorthand:
LifxCMD.exe -n "Lounge Lamp" -c AliceBlue -t 30000

Set the all lounge bulbs brightness to 50%
LifxCMD.exe --name Bulb1,Bulb2,Bulb3 --brightness 50%

I hope someone find this useful – If you do you are welcome to donate to my tshirt fund.. :)

Enjoy! Any problems hit me in the comments. :)

– TheNinja

Download “LifxCMD_v1.0.zip” LifxCMD_v1.0.zip – Downloaded 1441 times – 151 kB

Update: I have also added the source code below if someone wants to see if they can get it to work with the new Lifx Firmware(s).

Download “Lifx_CMD_v1.0_Source.zip” LifxCMD_Source.zip – Downloaded 1275 times – 5 MB

LifxCMD – Control your Lifx Bulbs from the command line was last modified: August 23rd, 2015 by admin
  • MattO

    Hi, this is exactly the type of program I’ve been looking for ever since the developer of lifxcl stopped his development. Whenever I try to run lifxcmd –list, I get the error message “No connection could be made because the target machine actively refused it” and then it lists my bulb’s IP address followed by the port it’s trying to connect on (56700). I’m running Windows 7 Home Premium 64bit, and I have all my bulbs updated to the latest 1.5 firmware. Any suggestions would be appreciated!

  • dK

    Idem same problem….lifxcmd crash with this socket exception error :
    Exception non gérée : System.Net.Sockets.SocketException: Aucune connexion n’a pu être établie car l’ordinateur cible l’a expressément refusée IP:56700.
    WIN8.1, LIFX Bulb in 1.5FW…

  • Linkan

    Hey Techninja, any news on the “target machine actively refused it” error?

  • Michael Tomlinson

    This is perfect. Any chance you will release the source code since you have stopped development?

    • Bob Banks

      I second that.

      • adamcaz

        Done for you Bob!

      • Michael Tomlinson

        Thanks! I will have a play sometime. Agree about supporting aussie companies, but it does seem like LIFX need some help with their software :-)
        Another way to control these babies (which I’m using at work for a continuous integration server ‘build light’ (it goes red if trunk breaks)) is via their REST API. You register your globe and get an authentication token, the control the globe with simple REST commands – you can even just use CURL from the command line. Disadvantage is you need the internet – it’s not local.

    • adamcaz

      Hi Michael, I have uploaded the source code for you.
      Let me know if you can get it to work with the new Lifx firmwares..
      A.

  • lone wrecche

    Damn, it just errors out, and is exactly what I was looking for to use with flirc.

    Why isn’t there just a simple program like this that works. Everything else I’ve found is a python mess with outdated dependencies and broken links.

    seems I’m stuck using the god awful windows 10 app or unlocking my phone every time I want to change a light setting, I mean, they should even allow an official command line utility. I like the bulb, sure, but why, like everything else, is support for it so assholed…

    :/