Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. Mi-Light controller for Mysensors

Mi-Light controller for Mysensors

Scheduled Pinned Locked Moved My Project
69 Posts 15 Posters 38.0k Views 27 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    ted
    wrote on last edited by ted
    #1

    MiLight is a radio controlled RGB-W LED light bulb. You can buy them from ebay or aliexpress for about $10-$15 a piece. The light bulb is controlled by a handheld controller. The RF chip used in these lights are PL1167 but fortunately, people have reverse engineered the RF protocol (see https://hackaday.io/project/5888-reverse-engineering-the-milight-on-air-protocol) and have developed code to control these lights using a NRF24 radio.

    I have adapted these code to control these light bulbs using a mysensors module, which also serves as a repeater node. Once it receives command from the gateway, it switches to a different operation mode to simulate PL1167 and send commands to control the LED bulb. Afterwards, the sensor switches back to NRF24 mode and serve as repeater.

    The code currently supports two modes of operation: (1) turn the white light on/off using a light switch node; and (2) relay any command that is supported by the MI protocol using a custom sensor node.
    You need to 'pair' the light bulb with the controller the first time using it (UPDATE: you can do the pairing using the repeater node. No need to buy a separate wifi or wireless controller). To do so, turn on the power switch and send 'on' command to the light bulb within couple of seconds. The led bulb will flash a couple of times if the paring is successful.

    If you have multiple LED lights, you can assign each light with the same or different remote ID so you can control them as a group or individually.

    The code can be downloaded here (also see below for required library):
    0_1460251721914_open_Mi_Light_Controller_repeater.zip

    1 Reply Last reply
    8
    • hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by
      #2

      Great!
      You should add this project (with a image) to openhardware.io so it becomes easier to find.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Fabien
        wrote on last edited by
        #3

        Wonderfull. I have a lot of milight bulbs and using openmili too. Your work is fantastic, I will try it when have little time.

        1 Reply Last reply
        0
        • Cliff KarlssonC Offline
          Cliff KarlssonC Offline
          Cliff Karlsson
          wrote on last edited by
          #4

          can rgb bulbs also be controlled/set color/dim ?

          T 1 Reply Last reply
          0
          • Cliff KarlssonC Cliff Karlsson

            can rgb bulbs also be controlled/set color/dim ?

            T Offline
            T Offline
            ted
            wrote on last edited by
            #5

            @Cliff-Karlsson
            Yes, I can control RGB color as well. The node can relay any command from the gateway to the Mi Bulb. It can implement the full capability of the original remote controller. The format of the MI protocol can be found here: https://hackaday.io/project/5888-reverse-engineering-the-milight-on-air-protocol . The node receives the command as a ASCII string; it then convert it to HEX format and send it to the bulb.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              koen01
              wrote on last edited by koen01
              #6

              i'm getting this error:

              [code]
              open_Mi_Light_Controller_repeater.ino:3:23: fatal error: nRF_24L01.h: No such file or directory
              compilation terminated.
              [/code]

              T 1 Reply Last reply
              0
              • K koen01

                i'm getting this error:

                [code]
                open_Mi_Light_Controller_repeater.ino:3:23: fatal error: nRF_24L01.h: No such file or directory
                compilation terminated.
                [/code]

                T Offline
                T Offline
                ted
                wrote on last edited by
                #7

                oops. I forgot to attach the modified nrf24 library.
                Somehow the module that simulates PL1167 is not compatible with mysensors' nrf24 library; instead, it requires the nrf24 library found here: http://tmrh20.github.io/RF24 , which, strangely, is not compatible with mysensors. So I end up with using two different nrf24 libraries, one for mysensor and the other for simulating PL1167. To make this work, I have to change the variable/file names of one of the libraries. Maybe there is something I didn't do correctly. Anyway, if you import the following library, it should work. 0_1460766143691_RF_24-master.zip

                @koen01

                1 Reply Last reply
                0
                • Cliff KarlssonC Offline
                  Cliff KarlssonC Offline
                  Cliff Karlsson
                  wrote on last edited by
                  #8

                  I just ordered four 9w rgbww bulbs to try your script out. But when reading the reviews one of the main disadvantages I found where that it was not possible to query the bulbs for the current state/color/dim-level.
                  But if the bulbs are wired so that they are always on then the script/repeater-node or the controller keep track of all the states, right?

                  Also is it possible to connect an battery powered arduino/nrf to the existing non powered wall-switch and have the arduino to send the switch-commands directly to the mi-light-repeater-node for faster reaction times for turning the bulbs on/off?

                  T 1 Reply Last reply
                  0
                  • Cliff KarlssonC Cliff Karlsson

                    I just ordered four 9w rgbww bulbs to try your script out. But when reading the reviews one of the main disadvantages I found where that it was not possible to query the bulbs for the current state/color/dim-level.
                    But if the bulbs are wired so that they are always on then the script/repeater-node or the controller keep track of all the states, right?

                    Also is it possible to connect an battery powered arduino/nrf to the existing non powered wall-switch and have the arduino to send the switch-commands directly to the mi-light-repeater-node for faster reaction times for turning the bulbs on/off?

                    T Offline
                    T Offline
                    ted
                    wrote on last edited by
                    #9

                    @Cliff-Karlsson

                    Yes, it is possible to keep track of the bulb state from the controller.

                    As to the switching speed, it is almost instantaneous (<<1 s). You can for sure add another node, but that will make the whole thing much more complicated to build.

                    Cliff KarlssonC 1 Reply Last reply
                    0
                    • T ted

                      @Cliff-Karlsson

                      Yes, it is possible to keep track of the bulb state from the controller.

                      As to the switching speed, it is almost instantaneous (<<1 s). You can for sure add another node, but that will make the whole thing much more complicated to build.

                      Cliff KarlssonC Offline
                      Cliff KarlssonC Offline
                      Cliff Karlsson
                      wrote on last edited by
                      #10

                      @ted

                      Thanks, I forgot to ask but if the node(s) have the full capability as the original remote controler. That means that I can also control ledstrips using the mi-light led dimmers like this: Led controller right?

                      T 1 Reply Last reply
                      0
                      • Cliff KarlssonC Cliff Karlsson

                        @ted

                        Thanks, I forgot to ask but if the node(s) have the full capability as the original remote controler. That means that I can also control ledstrips using the mi-light led dimmers like this: Led controller right?

                        T Offline
                        T Offline
                        ted
                        wrote on last edited by
                        #11

                        Assuming the on-air protocols are the same, yes.
                        I only have the RGB-W light bulb and were able to control it without ever using the remote controller.
                        @Cliff-Karlsson

                        1 Reply Last reply
                        0
                        • Cliff KarlssonC Offline
                          Cliff KarlssonC Offline
                          Cliff Karlsson
                          wrote on last edited by
                          #12

                          @ted said:

                          (1) turn the white light on/off using a light switch node

                          What does this mean? do I connect a light switch to the repeater-node? Or does it just mean that I can use another arduino to detect button-switches and send command to domoticz or other controller?

                          1 Reply Last reply
                          0
                          • Cliff KarlssonC Offline
                            Cliff KarlssonC Offline
                            Cliff Karlsson
                            wrote on last edited by
                            #13

                            I have received my lamps now but no controller yet. Is it possible to pair/control the bulbs without controller?

                            T 1 Reply Last reply
                            0
                            • Cliff KarlssonC Cliff Karlsson

                              I have received my lamps now but no controller yet. Is it possible to pair/control the bulbs without controller?

                              T Offline
                              T Offline
                              ted
                              wrote on last edited by
                              #14

                              @Cliff-Karlsson
                              To pair, turn on the light switch, and send 'ON' command within 2-3 seconds. If successful, you will see the light flash on and off a couple of times.

                              The repeater-node simply relay any command it receives from the controller (I use openhab) to the light wirelessly. There is no physical wire connection between the node and milight.

                              1 Reply Last reply
                              0
                              • Cliff KarlssonC Offline
                                Cliff KarlssonC Offline
                                Cliff Karlsson
                                wrote on last edited by
                                #15

                                Ok, I meant to say that I had not got any bridge for the mi-light yet. In the first post it is mentioned that you need to pair using a bridge.

                                T 1 Reply Last reply
                                0
                                • Cliff KarlssonC Cliff Karlsson

                                  Ok, I meant to say that I had not got any bridge for the mi-light yet. In the first post it is mentioned that you need to pair using a bridge.

                                  T Offline
                                  T Offline
                                  ted
                                  wrote on last edited by
                                  #16

                                  @Cliff-Karlsson
                                  thanks, the original post was updated to clarify this.

                                  1 Reply Last reply
                                  0
                                  • Cliff KarlssonC Offline
                                    Cliff KarlssonC Offline
                                    Cliff Karlsson
                                    wrote on last edited by
                                    #17

                                    Thanks, next stupid question. How do I control the rgb/dimming features of the lamp? I got a ordinary on/off lamp under device in domoticz.

                                    T 1 Reply Last reply
                                    0
                                    • Cliff KarlssonC Cliff Karlsson

                                      Thanks, next stupid question. How do I control the rgb/dimming features of the lamp? I got a ordinary on/off lamp under device in domoticz.

                                      T Offline
                                      T Offline
                                      ted
                                      wrote on last edited by
                                      #18

                                      @Cliff-Karlsson
                                      You have to program your controller to produce the command string and send it to the node. The command string is transmitted as a ASCII string to the 'custom' node. See https://hackaday.io/project/5888-reverse-engineering-the-milight-on-air-protocol for the command format. Sorry I don't use domoticz.

                                      1 Reply Last reply
                                      0
                                      • Cliff KarlssonC Offline
                                        Cliff KarlssonC Offline
                                        Cliff Karlsson
                                        wrote on last edited by
                                        #19

                                        Do I need to unpair the bulbs if I want to try pairing again? It got paired as a regular on/of bulb the first time. But I think I found out that I could add mi-lights using a dummy switch. But The bulb are not pairing.

                                        T 1 Reply Last reply
                                        0
                                        • Cliff KarlssonC Cliff Karlsson

                                          Do I need to unpair the bulbs if I want to try pairing again? It got paired as a regular on/of bulb the first time. But I think I found out that I could add mi-lights using a dummy switch. But The bulb are not pairing.

                                          T Offline
                                          T Offline
                                          ted
                                          wrote on last edited by
                                          #20

                                          @Cliff-Karlsson
                                          I don't know. Let us know what you find out. :)
                                          To unpair, you turn on the power to the bulb and send 'off' command within seconds.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          16

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular