Home Automation: Using the Raspberry Pi to control the lights in your home over Wi-Fi

 

Raspberry Pi + Wi-Fi Bulb = Automated House

 

The problem

Ever since I can remember, I have always wanted to control the lights in my home from a central location and in an automated manner, namely from a computer. But there were just too many obstacles which have prevented me from achieving this… until now. The biggest problem was the need for pairs of wires to run from each light to the computer. That meant a lot of wires (which translates to a lot of money, but also to a big, messy block of wire endings at the computer) and it also meant digging/drilling/cutting into the walls to hide the wires from sight.

Problem: Cables and Money

It was the only possible solution because the current had to run from each light to the device that switches them on and off, so there was no way to avoid this big mess. Also, there was another problem. You want to be able to control the lights spontaneously and quickly whenever you need to, which means that the controlling computer has to be up and running all the time, which is a waste of power (and money) and permanent noise in the room where the command center is established, which is usually a room in which you want peace and quiet or maybe even to sleep in. Finally, let’s not forget that in spite of the strong desire to automate my lights, I never wanted to spend a fortune on it. So for many years an elegant and affordable solution has eluded me… until the Christmas of 2013.

 

Raspberry Pi

Fortunately the technology related to home automation has progressed enormously in the last few years and new pieces of hardware have been developed which provide easy solutions to the above problems. The first important piece of the puzzle has emerged at the beginning of the year 2012, when the Raspberry Pi computer was officially released.

Raspberry Pi

The Raspberry Pi is a small, noiseless computer, which has a very low power consumption (typically 1-2 Watts) and is very lightweight. It takes up little space in the room and most importantly it is cheap (the official price is 25$ for model A and 35$ for model B). In other words it is the perfect choice for a computer to control the lights in your home. Some may argue that it is not very easy to use because it runs Linux (not Windows), but the truth is that Linux is really easy once you get the hang of it and it is very reliable, making it a good choice for home automation projects.

 

Wireless bulb sockets

The other very important component of this home automation solution is the ability to control the lights in a wireless manner, preferably both from home and from far away. Wireless sockets for light bulbs have appeared on the international market not so long ago. These are bulb sockets (E27, E26, E14, B22, etc.) which you screw into the existing socket and then you install your light bulb into these sockets. They contain radio receivers and you can use a remote to switch the socket on and off, putting your light bulb in an on or off state.

Wireless Socket

The good thing about these sockets is that you can keep your existing light bulbs. The not so good thing is that they will be a bit bulky and ugly unless you have a large lamp to conceal them. Also, I’ve never seen wireless bulb sockets so far which can be controlled with anything but simple radio signal transmitters, meaning that you can only send commands to them from your home. If you want to turn them on and off from far away, you need to reverse engineer their protocol and use a radio transmitter on your Raspberry Pi to send them the same signals that their remote is sending. Time consuming and cumbersome. Unless, of course, there are wireless bulb sockets out there which have an open specification which lets you know what signals to send, but I’ve never seen one until now. Finally, all that these wireless sockets can do is to turn the lights on and off, which is great in itself, but if you have higher aspirations, like dimming the lights or changing their color, then the sockets are not a good enough solution.

 

Wireless LED bulbs

Luckily there’s another technological development that has progressed rapidly in the last few years: wireless LED bulbs. These are light bulbs which can be controlled through radio signals directly (no special socket required). Most of them support dimming and changing the light color, which is a beautiful thing to do.

Wireless Bulb with Remote

The ones that we’ve seen until now were quite similar to the wireless sockets in the sense that the way you could control them was through a wireless remote. Unfortunately this meant that if you wanted to control them from a central computer (which also gives you the ability to control them from outside your home), you also had no choice but to reverse engineer their protocol and send the appropriate signals from a radio transmitter attached to the computer, which is hard to do. The fact that these bulbs produce light using LEDs is a good thing because they are very energy efficient and last for many years, but until recently it was also their major drawback because they just weren’t bright enough and could be used only for ambient lighting.

 

Smart Wi-Fi LED bulbs

Three brands of wireless LED bulbs stand out today from the rest: Philips HUE, LifX and MiLight / LimitlessLED / EasyBulb. There are two main characteristics that separate these three from the usual wireless LED bulbs: they are bright enough for comfortable everyday use and they can be controlled over Wi-Fi (not just with a remote that sends radio signals).

Smart Wi-Fi LED bulbs

Unfortunately none of them is perfect, each of them has smaller or bigger weaknesses, but they are good enough to be used in home automation projects. Philips HUE was the first to show itself to the public. Unfortunately, because it was the only such product on the market for some time, it’s price is ridiculously high, so high that I would not buy it unless I had money to throw away. But it is also the one that has the most versatile smart phone app. LifX was the second to emerge. It is bright (over 1000 Lumens) and promises a very versatile and comfortable smart phone app (for Android and iPhone). It’s price is much less compared to HUE, but it’s still high (89$ for a bulb). The biggest problem of LifX, however, is that you have to order it well in advance and wait months until you get your bulb.

 

MiLight/LimitlessLED/EasyBulb

And so we arrive to the wireless LED bulb which I prefer to use in my home automation projects. In different parts of the world it has different names: MiLight, LimitlessLED and EasyBulb. Unlike HUE or LifX, this bulb has quite a fair price (somewhere around 25-40$ for a bulb depending on where and when you buy it) and it is available today, not months from now, something that the manufacturers take pride in. It has been developed over the last couple of years and it is still being improved. MiLight is a bit less luminous compared to HUE and LifX, with the most recent RGBW bulb producing 800-850 Lumens at full brightness, but I’ve tested it myself and it is surprisingly bright (in spite of the specs), fit for everyday lighting. Its colors are very nice, saturated and vivid and the brightness can be set in fine steps.

Here is the presentation video for MiLight bulbs, to give you an idea of how it looks and what can be done with it:

The way I encountered MiLight was through the kindness and benevolence of Santa. A very special person, who knows that I’m a big fan of home automation, has whispered to him that some WiFi LED bulbs would make me happy. And they did, when Santa put 3 9W RGBW Milight bulbs, a wireless remote and a V3 wireless bridge under the Christmas tree this year (2013). Actually, I’m more excited about these MiLight bulbs than Santa or myself would have ever imagined because they look so nice and they are surprisingly bright. Also, they are very easy to communicate with, which finally allowed me to turn my dream of automating the lights in my home into reality. Getting such a wonderful present for Christmas came as an overwhelming surprise. After a few days of experimenting and reading about them I realized that, when coupled with a Raspberry Pi, the MiLight system can be turned into an affordable and elegant light automation solution.

 

MiLight technical details

So let’s take a look at the technical details. The MiLight system consists of 3 main parts:

The MiLight system

The new 9W RGBW wireless LED bulb contains 15 white LED chips and 9 RGB LED chips. While the white ones give a strong and pleasant warm white light that can be used for everyday lighting, the RGB LEDs are perfect for setting the mood in the room. Inside the bulb, which is quite heavy, by the way, there is also a 2.4 GHz radio wave receiver, which is waiting for commands from the wireless remote or from the wireless bridge. Available socket types are E27, E26 (Edison screw), E14 (through adapter) and B22 (bayonet mount). The new 9W RGBW LED bulb is said to last over 50.000 hours (about 25 years of regular usage), consumes about 10W at full brightness and  about 0.3W when turned off (but listening to commands), making it a good long term money saver. Of course, it can also be turned off from the regular wall switch, in which case it does not consume any power but it also won’t respond to wireless commands. It has a very pleasant warm white tone and also 255 distinct other color shades. A “party mode” is also available, in which the bulb will automatically cycle through the colors. I personally find the 9W RGBW lights to be the best, but MiLight also has simple 6W white and RGB bulbs for sale.

The wireless remote or the wireless bridge are needed to control the bulbs. One of them is sufficient, but it’s more comfortable if you have both. The wireless remote is the simpler, conventional way of sending radio signals to the bulbs, but it’s also the quickest one because you can simply pick up the remote and press it’s buttons. The Wi-Fi bridge is needed if you wish to control the bulbs from a smart phone, from a computer or from some  other Wi-Fi enabled device. It also provides the ability to play with the lights from far away (from outside home). The Android and iPhone apps are available as free downloads. They aren’t extremely optimized for user comfort, but still they are relatively fun to use and cover all the basic functions (on/off, brightness, colors, disco mode, etc.). Both the wireless remote and the smart phone apps (which by the way don’t seem to be available for (some) tablets) can command a maximum of 4 bulb groups (zones). Each group can contain hundreds of bulbs and all groups can be controlled by several remotes or wireless bridges. But if you need more than 4 zones in your home, then you’ll have to get more than one remote or wireless bridge.

 

Why MiLight?

So why would we use exactly MiLight with the Raspberry Pi to automate the lighting in our home? Well, first there are the obvious reasons: it’s affordable, bright enough, the colors look great, lasts very long and it’s energy efficient. Also, it can be controlled over Wi-Fi from home and from far away. But there is one very important thing that makes the MiLight wireless bridge very suitable to use in more advanced home automation projects: it is very easy to communicate with and it has an open API, in the sense that the commands which it uses to control the bulbs are publicly available on the LimitlessLED website’s developer section. This is why it’s easy to send commands from a Raspberry Pi to the wireless bridge and control the bulbs through it. The Pi simply has to send the known UDP command messages to the bridge, which will translate them into radio signals understood by the bulbs. No need to guess or reverse engineer the protocol, it’s all documented. No need to transmit radio signals from the Pi directly, the wireless bridge does that for us if we send messages to it through UDP.

 

Components

Raspberry Pi, MiLight wireless bulb and MiLight wireless bridge

Our lighting automation system will consist of the following components:

This means that the cost of the system starts from a minimum of around 140-150$, depending on where you manage to get the components from and what you use exactly, but also on how many and what kind of LED bulbs you attach to the system.

 

How it works

After getting the Raspberry Pi up and running (there are many guides out there about how to do this, but it is very simple, works mostly out of the box), you can log into it either directly (if you attach a monitor and a keyboard to it) or via SSH if you use it in headless mode. The great thing about connecting to it via SSH is that you can do it locally, in your home network, but also from outside networks, through any SSH client. On Windows machines I use the putty SSH client and on Android devices I use Juice SSH, both of them being simple and working great. To communicate with the MiLight wireless bridge, we will need to run some software on the Raspberry Pi which sends UDP messages to the it. I have created such a simple command line Linux program, simply called the “MiLight/LimitlessLED/EasyBulb RGBW v3.0/v4.0 Command Line Utility”.

The binaries can be downloaded from here.

wget http://iqjar.com/download/jar/milight/milight_binaries.zip

The C++ source files are also available for download here, in case you wish to tweak them.

wget http://iqjar.com/download/jar/milight/milight_sources.zip

Yes, it’s all completely free!

 

The MiLight/LimitlessLED/EasyBulb RGBW v3.0/v4.0 Command Line Utility

MiLight Linux command line utility

This lightweight command line Linux program can be used to send commands to the MiLight RGBW light bulbs, one at a time, through the MiLight wireless bridge v3.0/v4.0  (not compatible with earlier versions of the bridge). The program consists of two files:

    • milight – the executable
    • milight.conf – the configuration file

The configuration file simply contains three lines of text. The first line is the address (IP) of your MiLight bridge in your local area network. It is assigned through DHCP by default but it can be set to a fixed local IP address. You can find and set this IP address using your router’s configuration page. By default it is assumed to be 192.168.1.2, but it is likely that your router will assign a different IP address to the MiLight bridge. The second line is the port number on which the communication occurs with the MiLight wireless bridge. By default it is 8899, but it can be changed through the MiLight bridge‘s configuration page (at http://10.10.100.254/home.html by default). The third line can be used to output the command that was sent to the wireless bridge. When the third line contains the text “VERBOSE”, the utility will write the sent command, the destination IP address and the destination port number to the standard output.

If you ever forget the arguments with which you can call the milight command line utility, just call it without any parameters and it will tell you how to use it:

milight [ZONE] COMMAND [PARAMETER]

The optional ZONE argument specifies which bulb zone the command refers to. If this argument is omitted, the command is considered to refer to all zones. Possible values:
ALL/0 – All zones
1 – Zone 1
2 – Zone 2
3 – Zone 3
4 – Zone 4

The COMMAND argument specifies the command to be sent to the given bulb zone. Some commands require a parameter (see below). Accepted commands:
ON – Turn the bulbs in the given zone on.
OFF – Turn the bulbs in the given zone off.
WHITE/W – Set the color of the bulbs in the given zone to white.
DISCO/D [+/-] – If no parameter is specified, turn disco mode on. The ‘+‘ optional parameter increases the disco speed. The ‘-‘ optional parameter decreases the disco speed.
BRIGHTNESS/B VALUE – Set the brightness of the bulbs in the given zone.
The VALUE mandatory parameter specifies the brightness and must be an integer number in the range 1-19.
COLOR/C VALUE – Set the color of the bulbs in the given zone. The VALUE mandatory parameter specifies the color and must be an integer number in the range 0-255.

For example, if you wish to turn on all lights, call:

./milight on

If you wish to turn off all the lights, call:

./milight off

If you wish to set the brightness of the lights in zone 2 to minimum, call:

./milight 2 b 1

If you wish to set the color of the lights in zone 2 to some kind of blue, call:

./milight 2 c 5

 

Why combine MiLight with Raspberry Pi?

You might be wondering why it is a good idea to use a Raspberry Pi to control your MiLight bulbs when it’s quite easy and fun to use them even without a Raspberry Pi, and they can be controlled in a wireless manner anyway, from home or from away, using the wireless remote or a smart phone. Well, the command line utility presented above is very basic and might not impress much at first sight, but once you get it working, it opens a world of endless possibilities. To mention just a few:

    • It can be used to transmit various predefined sequences of commands to the bulbs.
    • It can be called from a fancy web page which will allow you to control your lights over the web (you’ll need a web server on the Pi for this, perhaps Apache or Tomcat? See this article if you need a basic guide).
    • It can be used to turn lights on or off based on a schedule (at given hours of the day).
    • It can send commands to the LED bulbs in response to events triggered by sensors (such as motion, temperature, etc).
    • You can call the command line utility when you receive an e-mail and blink your lights to notify you.
    • You can turn the lights on automatically when somebody enters the room or when the sun goes down.
    • You can attach a microphone to the Raspberry Pi and issue voice commands to control your lights in the most comfortable way ever.

The possibilities are endless. With a little bit of knowledge and imagination, you can have the most modern lighting system that exists today, with MiLight LED bulbs controlled by a Raspberry Pi. Have fun :)

 

Final word

I realize that this article sounds a bit like advertisement for the Raspberry Pi and for the MiLight LED bulbs. Even though this was not my original intention, I don’t mind that it turned out this way… they both are great devices which help us live a more interesting life. I like to believe that both were created with innovation in mind and the purpose was much more than just to sell a product. I like to believe that both were invented to help us unleash our own creativity and to create more advanced devices. Both of them have reasonable prices and appeal to the mind of the technology oriented people. So, yes, I do like them very much and I like to advertise them, even though there’s nothing in it for me, except the thought that through my article other people will get to know and enjoy these technological wonders, just like I do :) .

Special thanks to NailGlaze for making me acquainted with MiLight and for the most wonderful Christmas present I could ever imagine!

 


Comments

Home Automation: Using the Raspberry Pi to control the lights in your home over Wi-Fi — 78 Comments

  1. interesting project, any chance tpo have similar approach with radio controlled more than wi-fi? not with integrated bulbs but adding a radio recever component in the whall box used for normal light switches?
    regards

    • Yes, I can see that too happening: radio controlled wall switches, wall plugs or even bulbs. But it’s probably more work than the MiLight system.

  2. Hi iqjar,

    first i like to thank u for providing us with such great opensource code :)

    since i am not this good at c++ maybe u can help me out/Implement a Feature.

    I like to write the last choosen color value in a text file to read it the next time i change the color and fade to that color. Because i don’t like the hard switch. Also it would be nice to have the fade speed read from the config file.

    If you could help me out i would be happy :)
    Thanks again for your work.

    ps: could i also use a simple terminal command like “nc” to send udp pakets? So maybe i can write a script myself :)

    • Hi there!

      I’m happy that you enjoy the utility :)
      I’m afraid I cannot write the code for you, at least not any time soon, because free time is very scarce for me these days. But I can give you a few ideas. Write a function which writes the color value to an output file. The easiest way is probably to open the output file
      FILE* f = fopen("MyFileName", "wt");
      and to write the color to it
      fprintf ("%d", color);
      then close the file
      fclose(f);

      You read the value back in a similar way:
      FILE* f = fopen ("MyFileName", "rt");
      int color = 0;
      fscanf (f, "%d", &color);
      fclose(f);

      Read the documentation for these functions to handle the possible errors. For example fopen() returns NULL if it can’t access the file, so you’ll have to watch out for that.

      to fade from one color to another, you can probably call the setting of the color for every color between the too:

      int diff = (color1 < color 2) ? 1 : -1;
      for (int i = color1; i != color2; i+=diff)
      {
      //Call code to set the bulb color to i
      }

  3. I have a strange but reproducible problem with this code: it works but after using it (even just a single time), my bulb switches off after about 30 seconds. I can switch it back on, but it will keep on switching off by itself. After unlinking the bulb and resetting the wifi controller things go back to normal. Firmware 4.02.10T.jcy01

    • That really is awkward. I never ran into this issue with my bulbs. Is your MiLight wireless bridge version V3 and are your bulbs the 9W RGBW bulbs? Do they only start switching off after 30 sec if you use this code or it happens also after you operate them from your phone?

    • Working fine for me.

      Same firmware as you, but I got mine from Easybulb.

      What version is your Wifi box? Mine is V3. If you have V4 (which is the one LimitlessLED is shipping now) there might be some issues. Can you check your wifi box version?

  4. I have the 9W RGBW, I am not sure which bridge I have (where does it show the version?). I only get this problem when I use the code, not when I use my phone. And even stranger, it only happens with zone 4, zone 1 and 2 work fine, I cannot test zone 3 as baby boy is sleeping, and I am not sure if it is due to the zone or the bulb (the light bulb in zone 4 is hard to access, so I’m not so keen on a swap test to decide). Is there anything in your code that treats zone 4 differently from zone 1?

    • I’ve tested all zones today. While zones 1 and 2 respond to command just well, zones 3 and 4 don’t respond at all. I’ll check the code soon…

      • I took a brief look at the code, but could not find any problem. I’ll have to investigate more. In the meantime, you can download some updated sources and binaries from here:
        http://iqjar.com/download/jar/milight/milight_sources.zip
        http://iqjar.com/download/jar/milight/milight_binaries.zip

        This version outputs to the standard output the UDP command that is sent to the MiLight bridge if you set the third line of the milight.conf config file to VERBOSE. This way you can compare the sent commands to the ones specified by the official MiLight documentation, found here:
        http://www.limitlessled.com/dev/

        So far what I’ve seen is that the command line utility sends the right commands, so perhaps the documentation is wrong?

        • OK, I’ve figured it out! The reason why zones 3 and 4 were not working with the command line utility is that the bulbs in zone 3 and 4 were only assigned to the manual remote, not to the Wi-Fi bridge. I have assigned the bulbs to zones 3 and 4 using the Android app and now all zones work perfectly, without any bug :)

  5. Hi Daniel!

    You can determine the version of the bridge by looking at the label. If you have the black label, then it’s V3, if you have the blue label, then it’s the old version. Well, I have only tested zones 1 and 2 because I’m only using 2 bulbs for testing so far… so there could be a bug related to zones 3 and/or 4… Theoretically the code treats all zones the same way, but there could be a bug hiding in the code somewhere. I can’t promise to take a look at the code or to try zones 3 and 4 very soon because I’m very busy with other things these days, but I’ll try to figure it out in a week or two. If you find anything in the meantime, please let me know.

  6. Amazing tutorial. Thanks for this.

    Does the white on RGBW bulbs just have one hue?

    I would love to be able to go from bright white to yellow in the evenings, but it doesn’t seem possible.

    Practically I see this working by activating both the white light and the colored RGB lights at once. That way you should be able to get a lot of hues.

  7. Hi there: I am working on the exactly same thing, but using the FS20 protocol and embedded Java, to control sensors and actuators (specially for heating and lights). Feel free to check it out at http://www.paulo-lima.org/hans

    The overall solution is cheaper then your, I guess … but I will look into integrating “MiLight” into Hans …

    I am planning to use your article about “controlling GPIO from a web browser” to setup a web interface for “Hans”. At the moment I can only control it via emails, or via a console application.

  8. have a look for the sunwait script from Dan Risacher. I compiled it for the raspberry now I can switch my milights at sun-up en sun-down.
    00 16 * 1 * sunwait sun down 53.9305771N 4.9534996E ; /etc/cron.d/groep1aan.sh

    • This might sound obvious, but did you try downloading the sources, then issuing the “make” command?
      What do you mean by “can’t seem to get it running”? It simply does not start? Any error in the system logs?

  9. Hi iq,

    Yeah the obvious bits I tried ;) this is was the output:

    g++ -c -o obj/commands.o src/commands.cpp
    Assembler messages:
    Fatal error: can’t create obj/commands.o: No such file or directory
    make: *** [obj/commands.o] Error 1

    after I created the ‘obj/’-dir it ran. Sorry to bother lol, it was a bit late ;)

    • Yeah :) When I saw the error message, I immediately thought that you’re missing the dir “obj”. Perhaps I should have included its creation in the make script… No bother, enjoy! :)

  10. Yeah pretty obvious huh :P

    Anyway, thanks for this great piece of coding.

    Other question: It seems to me that it only ‘finds’ the conf file in the current dir the milight is run. Is there a simple way to put this centrally? Would it work to copy it to /etc/ for example?

  11. Yes, currently it’s looking for the conf file next to the executable. If you want to modify this to an absolute path, open src/udpsender.cpp and find the line: “const char* ConfigFileName = “milight.conf”;”, then modify the relative path “milight.conf” to an absolute one, like “/etc/milight.conf” or whatever you prefer. Finally rebuild the executable by issuing the “make” command :)

  12. Hi!

    Also thanks a lot from me for the nice milight program. I’ve written a small bash script for smooth coloure change much better the the Disco mode.
    But,…there’s one strange thing: MILIGHT can be started from command line as well within a bash script. But why is it not possible to start a bash script including the milight commands from another bash script:
    #!/bin/bash
    ./slow-lamp.sh &

    slow-lamp.sh contains the milight commands and works well, but not if started from a the above shown mini bash script. Both are in the same directoty.

    Any idea?

    Regards

    Hardy

  13. Hi,

    I have a limitlessled set with wifi brige. From my Android device the lights are working. (10.10.100.254 8899
    Now I installed on my Raspberry with weget the milight_binaries.zip.
    Then unzip milight binaries.zip
    I can see now a folder wich containes 3 files, readme, config and binarys.
    In file config I changed the ip adress and the port to 10.10.100.2548899.
    Then cd /milight_binaries und comand ./milight on.
    Thena get the fault -bash: ./milight: Permission denied

    coul somone please bring me on the right track???

    best regards
    Thomas

    • Correction:
      made same thing with milight_sources.
      had to make a new dir obj/-d and than it worked with make.
      But now I have a fault :Failed to send command to LED bulb

      Regads
      Thomas

      • Kind of hard to tell what the problem is… most likely you’re sending to the wrong IP address or port. Check the list of devices in your router and make sure that the IP address of your MiLight bridge matches that in the config file.If this does not help, try adding some debug strings into udpsender.cpp and rebuild the app. That might help narrow it down.

    • Check the program’s permissions (ls -l) and make sure that the user trying to run it has the rights to run it. Or just try to run it as root (with sudo).

  14. Hello,
    I am a beginner and have no luck to get it going.
    Raspberry pi and Limitlessled RGW and brige from Jan.14

    Installed milight_sources.zip using wget.
    Then unzip milight_sources.zip
    Then cd milight_sources
    Then make
    Then change ip in milight.conf to 192.168.0.16 (this is the ip of the brige )and port to 8899.
    Then ./milight on

    Unfortunatly the lights are not going on but also no fault showing.

    pi@raspberrypi ~ $ cd milight_sources
    pi@raspberrypi ~/milight_sources $ ./milight on
    pi@raspberrypi ~/milight_sources $

    setings in src/upsender.cpp
    const char* DefaultAddress = “192.168.0.16″;
    const int DefaultPort = 8899;
    const char* ConfigFileName = “milight.conf”;

    Can somone please help.

    Best regards
    Thomas

  15. I had the same problem yesterday. It turned out that the router decided to assign a different IP to the MiLight bridge. I found the new, correct IP in the router’s settings (usually at 191.168.1.1) and updated the milight.conf configuration file, after which it worked just fine :)

  16. Beware, the following settings are just default fallback values:
    setings in src/upsender.cpp
    const char* DefaultAddress = “192.168.0.16″;
    const int DefaultPort = 8899;
    const char* ConfigFileName = “milight.conf”;

    The real settings are in the milight.conf file next to the milight executable.

    • Hello,
      I checked the ip in the router, that the ip of the brige is correct, Also can
      ping the ip of the brige from raspberry, With the Android app “milight”,
      I can turn the lights on and of. Only with the command ./milight on , nothing happens.
      Someone please give step by step instruction after I donloaded the milight_sources.zip with wget to the raspberry???
      regards
      Thomas

      • Hi Thomas!

        Why don’t you try downloading the binaries instead of the sources? I remember that you had some permissions problem with that. Just change the permissions and try it.

        Steps:
        1.Download the binaries using wget and unzip, like you did, let’s say to the folder /soft/milight
        2. cd /soft/milight
        3. sudo chown thomas milight
        4. ./milight on

        It should be this simple…

        If you get some error, please paste the exact error here, maybe I can help. If simply nothing happens, then I’ll try to modify the program to test for more errors and output error messages accordingly, but that might take a bit of time, as I’m quite busy these days.

  17. Thank you for your help and time.
    I unziped the milight_binaries to Desktop/Thomas/milight
    Then cd Desktop/Thomas/milight

    Then sudo chown thomas milight, not working.
    must I put sudo chown pi milight, if yes, still not working.

    pi@raspberrypi ~ $ cd Desktop/Thomas/milight
    pi@raspberrypi ~/Desktop/Thomas/milight $ sudo chown pi milight
    chown: cannot access `milight’: No such file or directory
    pi@raspberrypi ~/Desktop/Thomas/milight $
    pi@raspberrypi ~/Desktop/Thomas/milight $ ls -l
    total 4
    drwsrwsr-x 2 pi pi 4096 Feb 3 00:25 milight_binaries
    pi@raspberrypi ~/Desktop/Thomas/milight $ ./milight om
    -bash: ./milight: No such file or directory
    pi@raspberrypi ~/Desktop/Thomas/milight $
    pi@raspberrypi ~/Desktop/Thomas/milight $ ls -l
    total 4

    Do not know whats wrong

    regards
    Thomas

    • Hi,
      Downloaded milight_binaries.zip with wget
      unzip milight_binaries.zip
      changed ip in milight.conf to 192.168.0.6 8899
      gave right to milght to 755
      cd milight_binaries
      ./milight on

      lights still no going on.
      pi@raspberrypi ~/milight_binaries $ ./milight on
      pi@raspberrypi ~/milight_binaries $

      with remotecontroll and Milight app it works ok.

      Where is the problem??
      regards
      Thomas

  18. Hi Thomas!

    1. I’ve added some updated source files and binary files. Download them from the same location, the same way you did until now. I’ve added some additional code to output the possible errors encountered during sending the UDP commands. After you download the files, open the Readme and make sure that the version inside it is 1.03 (means you really have the updated files). after that edit milight.conf with your IP address, your port number and on the last line change the “NOT_VERBOSE” text to “VERBOSE”. This will tell the program that you want to see the details about the errors. After that try to run it as usual, see if you get any error messages.

    2. If the above still does not work, then maybe you should try sending the commands not just to a specific IP, but to broadcast the messages to all the devices in the LAN (I know, you checked your IP, but to me your problem description still sound like you’ve entered the wrong IP into the milight.conf file…). So replace the IP that you have in the milight.conf file with the broadcast IP. The official LimitlessLED dev page states: “you can UDP broadcast to 10.1.1.255 or 255.255.255.255 if you want all wifi bridges to receive the command on the LAN”. This never worked for me, but maybe it works for you.

    3. If it does not work, perhaps you need to try some other broadcast IP address. Run the command “cat /etc/network/interfaces” and you should see a broadcast IP there. Try with that one.

    Let me know how it goes.

    • Thanks a lot for your effort,
      Curently I am on the wat to Mexico and want be abel to test.
      I let you know in 10 days.
      Best regards
      Thomas

  19. Hi,

    downloded version 1.3
    Installed as before.
    Made sure again the correct ip.adress is 192.168.0.68899Verbose in .conf file I checked the ip in the router with the mac adress of the brige.
    ping 192.168.0.6 is ok.
    Still not working no error messages.
    Tryed to change ip adress to 10.1.1.255 or 255.255.255.255 no luck

    If I give you my ip adress and open port 21 for you, could you go online and see whats going on??

    regards
    Thomas

    • Hi Thomas!

      I’m sorry to hear it’s still not working. What puzzles me is that you get no error message, nothing. But now, that you’ve activated the verbosity, it does display messages like “Sent UDP command XXX to IP:Port”, right? So at least we know that the verbosity is working…

      I wish I could help you figure out what is wrong by checking your machine, but I honestly have no idea what the problem could be. For everybody else it works. Is there any special configuration on your Raspberry Pi? When was the operating system image put on it? When did you run apt-get update and apt-get upgrade last time? When did you update the firmware of your Pi last time?

      If you have the possibility to try it on another Raspberry Pi (maybe at a friend?), that might help understand if the problem is in your Pi or not. Otherwise I think the only way we can get to the bottom of this is by somehow sniffing the UDP packets being sent form your Pi to the router. That’s something I’ve never actually done, so I won’t be able to help with, but others have done it and you’ll probably find forums where you can get help.

      Anyway, the next logical step is to determine if your Pi is actually sending those UDP packages to the router or not. There might be easier ways to find that out, if you know any network experts, they might be able to help with that.

      If you manage to find out anything useful, please get back to me, I’m very curious what can be wrong.

      Andras

      • I have another idea. Try to find out how you can send UDP packages from Linux from command line. Then run the milight program, see what command it’s trying to send (with verbosity on) and then try to send the same command from command line. This way we’re attacking the problem from the other side, trying to eliminate the possibility that the bug is in the milight program.

  20. Hi,
    I updated mi rpi with latest firmware.

    still nothig happens with ./milight

    However with comands pi@raspberrypi ~ $
    echo -e -n \x35\x00\x55 | nc -u -q 0 192.168.0.6 8899

    echo -e -n \x39\x00\x55 | nc -u -q 0 192.168.0.6 8899

    the lights go on and off, so the ip adress is correct wich I put in the .conf file.

    My be the aplication is not for me.
    I use wifi to and from the rpi
    I use Limitlessleds the ones wich can only be within white cold and warm.

    • Hi Thomas!

      Wait a second! You’re not using the RGBW 9W Limitless LED bulbs, but simply the white ones? Well, that explains why it does not work :) This application is only meant to work with the 9W RGBW ones. But the god news is that you should be able to make it work with your own lights if you change the commands in the appropriate source file to send the right codes and compile the application. One of the source files clearly shows the codes being sent. Just update those, build the app and you’re good to go. I guess the hard part will be figuring out which codes you need to use. If you need help with rebuilding or something, let me know!

      Andras

  21. Hi Andras,
    thanks for your info.

    Now I installed the sources.zip, change in the commands.cpp the code for on and off, recompiled it and now the light go on and off with the command
    ./milight on ./milight off
    Thank you all for your help.

    I need now only to figure out how to set the correct code for Zone 1-4 etc….. google should help me………..

    Thanks again, I will com back if I need more help.
    Best regards
    Thomas

  22. Hi,
    can turn on/off all 4 zones induvidually as well on/off all together.
    Great code from you.
    Is ther a “ready made” bash script, to turn on and off the lights a a certain time with crontab -e (copy-paste)??

    Times for on/off to be defined in crontab.

    As you see I am a beginner, but learning……….

    Regards
    Thomas

  23. Hi,
    pi@raspberrypi ~/Thomas/milight_sources $ ./milight on
    pi@raspberrypi ~/Thomas/milight_sources $ ./milight off
    This is to turn on / off the light, and it works.

    This is the content of the new file “ein” a created: (has perm 755)
    The file “ein” is in /bin

    #!/bin/sh
    /home/pi/Thomas/milight_sources/milight on

    in sudo crontab -e made the folowing entry:
    * * * * */bin/ein ( trigger is every minute)

    Unfurtunatly it`s not working.

    regards
    Thomas

  24. Aren’t you missing a space character after the last * sign? “* * * * * /bin/ein”

    What if you try running some other non-milight related script from inside /bin/ein? Does that work?

    If you run /bin/ein as root (sudo /bin/ein) manually, does that work?

  25. This is what I get:

    pi@raspberrypi /bin $ sudo /bin/ein
    Unable to open milight.conf for reading!
    Using default address (192.168.1.2) and port (8899).
    pi@raspberrypi /bin $

    Regards
    Thomas

  26. Change in upsender ccp the ip from 192.168.1.2 to 192.168.0.6
    Made command “make” in Thomas/miligth_sources.
    Now everything is working.
    Light go on with cron, with ./milight off, go off
    Will make new script to turn off also with cron.

    Thanks again for your help.
    Best regards
    Thomas

  27. Well, I suppose that you checked and the milight.conf is there, next to the milight program. I guess that the milight program is looking for the config file in the current directory, not in its own directory, which is a problem that I should fix when I’ll have a bit of time. Until then you can probably work around the problem by changing the current directory in your /bin/ein script to the milight directory:

    #!/bin/sh
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight on

    Hope this helps :)

  28. Hi,
    yes this works ok like you wrote it.

    Everything is almost under controll,great toy.

    New question:

    The commmand ./milight 1 b 19 ( to set the brightness to full is not working)

    What and where do I hae to change,so the command works with the whith lamps?

    regards
    Thomas

    • Hi Thomas!

      I’m glad it works :) Unfortunately I don’t know for sure how you can control the brightness of white bulbs. Is there any specification anywhere on the net about how many steps you can use to control their brightness, what commands need to be sent and what values are accepted? If you can find these out, theoretically you can change the command in the same place where you changed it for on/off and also in one of the other source files you have to change the interpreting of the program arguments so that it accepts your range of values instead of 1 <= value <= 19.

  29. This is what I found for the white bulps (limitlessled.com/dev)

    FULL BRIGHTNESS ALL 0×35 100ms followed by: 0xB5
    FULL BRIGHTNESS GROUP 1 0×38 100ms followed by: 0xB8
    FULL BRIGHTNESS GROUP 2 0x3D 100ms followed by: 0xBD
    FULL BRIGHTNESS GROUP 3 0×37 100ms followed by: 0xB7
    FULL BRIGHTNESS GROUP 4 0×32 100ms followed by: 0xB2

    I think it can be dimmed in 10 steps.

    But I have no cloue what to to with this.

    Regrads
    Thomas

  30. Hi Thomas!

    If you open the source file commands.cpp, you’ll find a function in it called sendBrightnessCommand(). Inside it you will see a declaration of an array with 19 elements, which contains the 19 hexadecimal codes which work for the RGBW bulbs (their brightness can be controlled in 19 steps). The only thing that you need to change is this array (the number of codes in it and the actual codes in it). The problem is that the information you found is not enough. those are just the codes for max brightness. We need all codes, or at least the code for the minimum brightness, code for maximum brightness and the number of steps between them. From that info we could “guess” all the codes.

  31. Yeah, I just took a look at their updated page… many examples and not much order among them… but I could not find the codes and number of steps for white bulbs, only the codes for full brightness. So I guess the only thing left to do is to experiment and find them out. You know the codes for full brightness. Keep in mind that those are numbers in the hexadecimal system, you can convert them to “normal” decimal numbers and back using a calculator. From there, you’ll probably have to start sending smaller numbers for the brightness value and hope that they cause the brightness to decrease. Keep going down until you find the lowest limit. Actually, it might not be quite that simple. With my RGBW bulbs I found that as I decrease the number, the brightness sometimes goes down, other times it remains the same, and after a while it goes back up again. But there are only 256 possibilities in total, so you can go through them all and check which ones work for you. It’s a bit of a pain, but it feels great when you find out the codes. Then you can share them with the world, so the next person does not have to suffer through it ;) I don’t have any white bulbs, only RGBW ones, so I can’t help with this, only in theory. Let me know how it turns out!

  32. This is what I got from limitlessled;

    LIMITLESSLED RGBW DIRECTLY SETTING THE BRIGHTNESS is by a 3BYTE COMMAND: (First send the

    Group ON for the group you want to set the brightness for. You send the group ON command

    100ms before sending the 4E 1B 55)
    Byte1: 0x4E (decimal: 78)
    Byte2: 0×02 to 0x1B (decimal range: 2 to 27) full brightness 0x1B (decimal 27)
    Byte3: Always 0×55 (decimal: 85)

    Friend RGBW_Brightness10percent As Integer = &H2

    Friend RGBW_Brightness14percent As Integer = &H3

    Friend RGBW_Brightness17percent As Integer = &H4

    Friend RGBW_Brightness21percent As Integer = &H5

    Friend RGBW_Brightness24percent As Integer = &H6

    Friend RGBW_Brightness28percent As Integer = &H7

    Friend RGBW_Brightness32percent As Integer = &H8

    Friend RGBW_Brightness35percent As Integer = &H9

    Friend RGBW_Brightness39percent As Integer = &HA

    Friend RGBW_Brightness42percent As Integer = &HB

    Friend RGBW_Brightness46percent As Integer = &HC

    Friend RGBW_Brightness50percent As Integer = &HD

    Friend RGBW_Brightness53percent As Integer = &HE

    Friend RGBW_Brightness57percent As Integer = &HF

    Friend RGBW_Brightness60percent As Integer = &H10

    Friend RGBW_Brightness64percent As Integer = &H11

    Friend RGBW_Brightness68percent As Integer = &H12

    Friend RGBW_Brightness71percent As Integer = &H13

    Friend RGBW_Brightness75percent As Integer = &H14

    Friend RGBW_Brightness78percent As Integer = &H15

    Friend RGBW_Brightness82percent As Integer = &H16

    Friend RGBW_Brightness86percent As Integer = &H17

    Friend RGBW_Brightness89percent As Integer = &H18

    Friend RGBW_Brightness93percent As Integer = &H19

    Friend RGBW_Brightness96percent As Integer = &H1A

    Friend RGBW_Brightness100percent As Integer = &H1B

    So the range is from 2-27.When I type ./milight on, all lights go on
    Brightness I set to full via the remote, Then I type ./milight 0 b 2
    but nothing happens. Your range is from 2-19 , so is not limitlessled code from 2-19 the same and only from 20-27 different?? or additional??

    If I use; echo -e -n \x4E\x1B0\x55 | nc -u -q 0 192.168.0.6 8899 nothing happens,
    but with : echo -e -n \x35\x00\x55 | nc -u -q 0 192.168.0.6 8899 the lights go on.

    regards
    Thomas

    • You probably can’t use my RGBW brightness codes at all. You have to replace my array with 19 code elements with your own array, which will contain 25 (27-2) elements. Each element will be one of the codes that you posted here.

  33. Hi dear helper,

    below codes work for my white bulps, testet with UDP Sender. (android app)
    hex comand 350055 turns all on only 3500 also works
    hex comand 390055turns all off only 3900 also works

    All other comand below work in the same way

    The question now is how to integreat this codes to the software.

    regards
    Thomas

    MiLight White
    35 00 55 – All On
    39 00 55 – All Off
    3C 00 55 – Brightness Up
    34 00 55 – Brightness Down (There are ten steps between min and max)
    3E 00 55 – Warmer
    3F 00 55 – Cooler (There are ten steps between warmest and coolest)
    38 00 55 – Zone 1 On
    3B 00 55 – Zone 1 Off
    3D 00 55 – Zone 2 On
    33 00 55 – Zone 2 Off
    37 00 55 – Zone 3 On
    3A 00 55 – Zone 3 Off
    32 00 55 – Zone 4 On
    36 00 55 – Zone 4 Off
    B5 00 55 – All On Full (Send >=100ms after All On)
    B8 00 55 – Zone 1 Full (Send >=100ms after Zone 1 On)
    BD 00 55 – Zone 2 Full (Send >=100ms after Zone 2 On)
    B7 00 55 – Zone 3 Full (Send >=100ms after Zone 3 On)
    B2 00 55 – Zone 4 Full (Send >=100ms after Zone 4 On)
    B9 00 55 – All Nightlight (Send >=100ms after All Off)
    BB 00 55 – Zone 1 Nightlight (Send >=100ms after Zone 1 Off)
    B3 00 55 – Zone 2 Nightlight (Send >=100ms after Zone 2 Off)
    BA 00 55 – Zone 3 Nightlight (Send >=100ms after Zone 3 Off)
    B6 00 55 – Zone 4 Nightlight (Send >=100ms after Zone 4 Off)

    MiLight RGB
    22 00 55 – Lamps On
    21 00 55 – Lamps Off
    23 00 55 – Brightness Up
    24 00 55 – Brightness Down (There are nine steps between min and max)
    27 00 55 – Mode Up
    28 00 55 – Mode Down (There are 20 modes. The lowest is constant white)
    25 00 55 – Speed Up (Fast)
    26 00 55 – Speed Down (Slow)
    20 xx 55 – Set Colour to xx (value shown on MiLightRGB plugin converted to hexadecimal)

    Edit 15/03/2013 – Added additional MiLight White commands. Thanks to Hamish at LimitlessLED.

    • Hi Thomas!

      You need to modify the commands.cpp, taking out of it the RGBW codes and putting the white bulb codes instead, then compile it and test it. I would do it myself, it’s probably no more than a few hours of coding/testing, but one problem is that I don’t have white bulbs to test with and the even bigger problem is that I don’t have the time :) Take a good long look at the commands.cpp source file. The existing commands for RGBW should lead you on to what needs to be changed. Start by replacing the more basic commands first.

  34. Really great job! I would like to know if it is possible to combine the milight lamps e.g. with the boblight control sw… would be a great effect :))

    • Hi Roy!

      I don’t know what a boblight is, I’m afraid :) Milight bulbs react to radio waves sent at 2.4 GHz frequency. So if that boblight controller works at the same frequency, you might have a shot, but even so the chances are scarce, since it needs to send the right codes, which are understood by the light. You won’t know for sure until you try it, but I’m guessing it won’t work.

  35. Hi,

    since days in my free time I am trying, also with google….. no luck.

    I changed the value 0×02 to 0xB5 and compiled. This sould change with command
    ./milight 0 b 1 all lights to hi ?????

    What is sendCommand (0x4E, codes[brightness - 1]);

    bool sendBrightnessCommand (int zone, int brightness)
    {
    char codes[19] = {0xB5, 0×03, 0×04, 0×05, 0×08, 0×09, 0x0A, 0x0B, 0x0D,$
    0x0F, 0×10, 0×12, 0×13, 0×14, 0×15, 0×17, 0×18, 0x1B};
    bool result1 = sendOnCommand (zone);
    usleep (100000);
    bool result2 = UDPSender::sendCommand (0x4E, codes[brightness - 1]);
    return (result1 && result2);

    The best would be to have a byt 0 and 1 in the .conf file, 0=RGBW and 1= white bulps.

    If you send me your adress I send you a withe bulp for thesting for free.:-)

    Thanks again and regards

    Thomas

  36. Hi Thomas!

    Thank you for the offer to send me a white bulb, but I can’t accept it :) It would take at least 3-4 weeks for it to get from the US to Romania anyway… Instead I can offer this: when I’ll have a bit of time, I’ll try to put those codes into place and then send you the result, so you can try testing yourself. The only problem with this is that I can’t promise that it will happen any time soon. I’ve got a complicated situation at work right now and also in my personal life and I’m arriving home near midnight every day…

    Anyway, getting to the point, in the function that you pasted here, you see a declaration of an array called “codes” with 19 elements. This means that for RGBW there are 19 distinct steps for changing the brightness. YOur white bulbs have 26 distinct steps instead, so the first thing you need to do is change the size of the array from [19] to [26]. After that you need to get rid of the current codes in the array (0×02, 0×03, …, 0x1B) and replace them with your own 26 codes: 0×02, 0×03, …, 0x1B, as in the list of codes you wrote earlier. Other than that, the first byte of the command seems, which is 0x4E for RGBW, has to be changed to 0×35 for white, so you have to change the line “sendCommand (0x4E, codes[brightness - 1]);” to “sendCommand (0×35, codes[brightness - 1]);”

    Let me try to explain further: the line “sendCommand (0x4E, codes[brightness - 1]);” has two main parameters. The first value (0x4E for RGBW, 0×35 for white) tells the bulb that what you are trying to change is the brightness. The second value is taken from the array of brightness codes that we have just discussed and it tells the bulb the actual brightness value that you wish to apply.

    So to summerize, your sendBrightnessCommand function should look like this:
    bool sendBrightnessCommand (int zone, int brightness)
    {
    char codes[26] = {0×02, 0×03, 0×04, 0×05, 0×06, 0×07, 0×08, 0×09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0×10, 0×11, 0×12, 0×13, 0×14, 0×15, 0×16, 0×17, 0×18, 0×19, 0x1A, 0x1B};

    bool result1 = sendOnCommand (zone);
    usleep (100000);
    bool result2 = UDPSender::sendCommand (0×35, codes[brightness - 1]);

    return (result1 && result2);
    }

    In theory this should work, in practice, only you can test it :)

    Good luck, let me know how it goes!

  37. Hi,

    I did exactly what you wrote,compiled. ( cnaged in a diferent file also from 1-19< to 1-26.

    Made some progress, but still not working correctly.

    when I but instead of 0xE4 0×35 and do ./milight 0 b 1-26, the lights turn on but regardless off 0 b 1 or 2 or 26 the dimm level is allways the same.

    According to the code 35 is all lights on.

    Then I changed the code from 0×35 to 0x3C which is brightness up.

    Now everytime a do ./milight 0-4 b 1-26 the light go up one dimm level, all or per zone.

    Meanig that wehn I enter 6 or 7 times ./miligt 0-4 b 1-27 the zones or all go to max.brightness.

    If I understan it correct, behind the 0×02-0x1B (26) there is a different dimm level, meanig, from ./milight 0 b 2 to ./milight 0 b 3 the level sould go up one step.

    The question is now, where do I find the correct value behind 0×02-0x1B
    or how is it defined and where do I change it.

    Best regards to Romania from Switzerland.

    Thomas

    • Hi Thomas!

      Oh, I thought you were from the US… I don’t know why… best regards to Switzerland too ;)

      What you wrote is all correct. The hexadecimal values 0×02 to 0x1B represent brightness values and I saw them here: http://www.limitlessled.com/dev/

      According to the same web page, 0×35 is the code which is used to set the brightness of white bulbs by specifying an exact brightness value (globally for all zones). If you change this to 0x3C, it’s normal that it will increase the brightness by one increment regardless of what you specify as parameter, because 0x3C is the code for increasing brightness by one increment, not for setting it to an exact value.

      It’s hard to imagine what the problem could be… in theory you’re doing the right things. Maybe try to substitute 0×35 with the code which sets brightness for the first zone, then try setting the brightness of the first zone to different value, see if that works…

  38. Hi,
    I am away for 10 days so I only can test my raspberry over the internet with milight app ( and my wife on the phone to see what it does):-)

    What I found out from Limitlessled:
    Mail from them:
    Sorry my mistake for not reading closely, I thought you were talking about RGBW

    DualWhite only as up/down or full.
    Friend LimitlessLED_Command_WHITE_BRIGHTNESS_UP As Byte() = New Byte() {&H3C, &H0, &H55}
    Friend LimitlessLED_Command_WHITE_BRIGHTNESS_DOWN As Byte() = New Byte() {&H34, &H0, &H55}
    Friend LimitlessLED_Command_WHITE_GROUP_1_ALL_ON As Byte() = New Byte() {&H38, &H0, &H55}

    Only RGBW has increments.

    Friend RGBW_Brightness10percent As Integer = &H2
    Friend RGBW_Brightness14percent As Integer = &H3
    Friend RGBW_Brightness17percent As Integer = &H4
    Friend RGBW_Brightness21percent As Integer = &H5
    Friend RGBW_Brightness24percent As Integer = &H6
    Friend RGBW_Brightness28percent As Integer = &H7
    Friend RGBW_Brightness32percent As Integer = &H8
    Friend RGBW_Brightness35percent As Integer = &H9
    Friend RGBW_Brightness39percent As Integer = &HA
    Friend RGBW_Brightness42percent As Integer = &HB
    Friend RGBW_Brightness46percent As Integer = &HC
    Friend RGBW_Brightness50percent As Integer = &HD
    Friend RGBW_Brightness53percent As Integer = &HE
    Friend RGBW_Brightness57percent As Integer = &HF
    Friend RGBW_Brightness60percent As Integer = &H10
    Friend RGBW_Brightness64percent As Integer = &H11
    Friend RGBW_Brightness68percent As Integer = &H12
    Friend RGBW_Brightness71percent As Integer = &H13
    Friend RGBW_Brightness75percent As Integer = &H14
    Friend RGBW_Brightness78percent As Integer = &H15
    Friend RGBW_Brightness82percent As Integer = &H16
    Friend RGBW_Brightness86percent As Integer = &H17
    Friend RGBW_Brightness89percent As Integer = &H18
    Friend RGBW_Brightness93percent As Integer = &H19
    Friend RGBW_Brightness96percent As Integer = &H1A
    Friend RGBW_Brightness100percent As Integer = &H1B

    So this will not work with your software.

    I will now make a bash script to overcome this issue. I will send it for your info as soon its working in a test mode.

    Best regards
    Thomas

  39. Hi,
    below for your info find script the does a test function as follow:
    Zone 1 go on for 0.8 then off, Zone 2 go on for 0.8 then off, (until Zone 4)
    After sleep 2 all 4 zones go on for 0.1 followed by the 10 x dimm up, until the reach full.
    Then sleep 0.1 all on, sleep 0.1 then 10x dimm down until lowest.
    Then sleep 0.5, then turn off 4-3-2-1.

    This a can run with crontab -e and it runs very well for test purposes.

    This works now perfectly for my needs, with this commands I can do what ever I want.
    This is the first time a made a project like this, as you know I am not a programmer……and there are probably other way to to this.

    Thanks again for your kind help.

    Thomas

    #!/bin/sh
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 1 on
    sleep 0.8
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 1 off
    sleep 0.8
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 2 on
    sleep 0.8
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 2 off
    sleep 0.8
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 3 on
    sleep 0.8
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 3 off
    sleep 0.8
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 4 on
    sleep 0.8
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 4 off
    cd /home/pi/Thomas/milight_sources/
    sleep 2
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight on
    sleep 0.1
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 1 b 1
    /home/pi/Thomas/milight_sources/milight 2 b 1
    /home/pi/Thomas/milight_sources/milight 3 b 1
    /home/pi/Thomas/milight_sources/milight 4 b 1
    sleep 0.1
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 1 b 1
    /home/pi/Thomas/milight_sources/milight 2 b 1
    /home/pi/Thomas/milight_sources/milight 3 b 1
    /home/pi/Thomas/milight_sources/milight 4 b 1
    sleep 0.1
    cd /home/pi/Thomas/milight_sources/
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 1 b 1
    /home/pi/Thomas/milight_sources/milight 2 b 1
    /home/pi/Thomas/milight_sources/milight 3 b 1
    /home/pi/Thomas/milight_sources/milight 4 b 1
    sleep 0.1
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 1 b 1
    /home/pi/Thomas/milight_sources/milight 2 b 1
    /home/pi/Thomas/milight_sources/milight 3 b 1
    /home/pi/Thomas/milight_sources/milight 4 b 1
    sleep 0.1
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 1 b 1
    /home/pi/Thomas/milight_sources/milight 2 b 1
    /home/pi/Thomas/milight_sources/milight 3 b 1
    /home/pi/Thomas/milight_sources/milight 4 b 1
    sleep 0.1
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 1 b 1
    /home/pi/Thomas/milight_sources/milight 2 b 1
    /home/pi/Thomas/milight_sources/milight 3 b 1
    /home/pi/Thomas/milight_sources/milight 4 b 1
    sleep 0.1
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 1 b 1
    /home/pi/Thomas/milight_sources/milight 2 b 1
    /home/pi/Thomas/milight_sources/milight 3 b 1
    /home/pi/Thomas/milight_sources/milight 4 b 1
    sleep 0.1
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 1 b 1
    /home/pi/Thomas/milight_sources/milight 2 b 1
    /home/pi/Thomas/milight_sources/milight 3 b 1
    /home/pi/Thomas/milight_sources/milight 4 b 1
    sleep 0.1
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 1 b 1
    /home/pi/Thomas/milight_sources/milight 2 b 1
    /home/pi/Thomas/milight_sources/milight 3 b 1
    /home/pi/Thomas/milight_sources/milight 4 b 1
    sleep 0.1
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight 1 b 1
    /home/pi/Thomas/milight_sources/milight 2 b 1
    /home/pi/Thomas/milight_sources/milight 3 b 1
    /home/pi/Thomas/milight_sources/milight 4 b 1
    sleep 0.1
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight on
    sleep 0.1
    echo -n -e x34x00x55 | nc -u -q 1 192.168.0.6 8899
    sleep 0.1
    echo -n -e x34x00x55 | nc -u -q 1 192.168.0.6 8899
    sleep 0.1
    echo -n -e x34x00x55 | nc -u -q 1 192.168.0.6 8899
    sleep 0.1
    echo -n -e x34x00x55 | nc -u -q 1 192.168.0.6 8899
    sleep 0.1
    echo -n -e x34x00x55 | nc -u -q 1 192.168.0.6 8899
    sleep 0.1
    echo -n -e x34x00x55 | nc -u -q 1 192.168.0.6 8899
    sleep 0.1
    echo -n -e x34x00x55 | nc -u -q 1 192.168.0.6 8899
    sleep 0.1
    echo -n -e x34x00x55 | nc -u -q 1 192.168.0.6 8899
    sleep 0.1
    echo -n -e x34x00x55 | nc -u -q 1 192.168.0.6 8899
    sleep 0.1
    echo -n -e x34x00x55 | nc -u -q 1 192.168.0.6 8899
    sleep 0.5
    /home/pi/Thomas/milight_sources/milight 4 off
    sleep 0.8
    /home/pi/Thomas/milight_sources/milight 3 off
    sleep 0.8
    /home/pi/Thomas/milight_sources/milight 2 off
    sleep 0.8
    /home/pi/Thomas/milight_sources/milight 1 off
    sleep 0.8
    cd /home/pi/Thomas/milight_sources/
    /home/pi/Thomas/milight_sources/milight off

    • Hi Thomas!

      I received your messages, unfortunately I don’t have the brain power to understand them right now :) I’ll try to take a look in a day or two!

  40. Hi Thomas!

    OK, I have finally read and understood your recent comments.
    First of all I’m sorry to hear that white bulbs don’t offer the possibility to set their brightness directly. But it’s good to know that you managed to do the dimming using the up/down commands. Thanks for the bash script! As I don’t have white bulbs, I won’t be using it, but perhaps some of my readers will :)

    Also, congratulations for having the perseverance to pull it off. It took a long time and I imagine that you’ve spent quite some hours on this project. Beware, though, the feeling of success is addictive. Pretty soon you’ll be working on hobby projects like this all the time :)

    If you’ll need my help with the lights in the future in some different aspect, let me know ;)

    Andras

  41. Hi,
    For easy integration with my openelec system I took the liberty to convert your sources to python. For anyone who is interested, you can find the code here: http://pastebin.com/bctT8qBS

    Please note that the only diff with the original program is that the zone command is mandatory.

    Thanks for your original program and the nice article!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>