SmartThings Community

Magic Home WiFi LED Control

(Ph4r) #1

Update 2017-09-30: I have now added support for RGBWW strips! This is verified with both 24V and 12V Strips as well!

I bought a device that looked like a good deal to control my 24VDC RGB Strips (longer runs, still bright, and not as hot as 12VDC) in hopes that it would connect to SmartThings. When I later found that it didn’t and that the Alexa integration sends the username and password in plain text, I decided to make something to connect them.

Due to a limitation in the SmartThings Platform, I am not able to send RAW Hex values to a device, so I also had to create a Man-in-the-Middle solution to translate commands out to the device that runs on another platform. Hopefully in the future this is fixed and I can output directly to the device. Until this is in place, I have only intended to send commands, so I am not reading or authenticating responses from the device (such as should you change the state from the app or another method).

Here is the controller device that I purchased:

This DTH should work with anything that uses either of these apps for RGBWW Control:

Here is my DeviceTypeHandler:

Here is my Man-in-the-Middle source project:

Steps to Success:

  1. You need a supported architecture to run the tcptunnel (I use CygWin on Windows x64).

  2. git clone my tcptunnel repository and then configure tcptunnel

  3. make tcptunnel

  4. start tcptunnel and direct it to the IPAddress of your controller [in example, mine is at]

    ./tcptunnel --local-port=5577 --remote-port=5577 --remote-host= --log --stay-alive
    local-port = Listen Port on PC / Raspberry PI (Port for DTH Settings)
    remote-port = Port for LED Controller
    remote-host = IP Address of LED Controller

    PORT 5577 This is the default for Magic Home controlled LED devices. If you have multiple strips running through the same PC / Raspberry PI, you will need to run multiple instances of the program each with a unique Listen Port number, but likely all Remote-ports will still be 5577.

  5. Load DTH into SmartThings via IDE

  6. Create a new Device in the IDE of this DeviceType

  7. From your SmartThings App, goto this device’s settings, and put in the IP Address of your Man-in-the-Middle Server and port number. This is typically 5577; however, if you have multiple devices you will need a unique port for each Man-in-the-Middle Server.

  8. Control your RGB Lights!

Known Limitations:

  • This DTH has only implemented some Animations, all known animations are defined, but only some have buttons created.
  • Explictly: White Color Temperature is not implemented at this time (I can’t test them with my strips, needs RGBWW)
  • The Brightness Slider will update the light immediately for color changes and is not active for Animations
  • The Speed slider is a previous requirement for the Animations (if you change it you need to press an Animation Button to activate the change)
  • Does not poll current light status, it is only currently aware of settings made with this Device in SmartThings.
  • It has been reported with no logs that in some case changing brightness will also change the color of the RGB Channels, if you find this, please send the TCPTunnel Console Data.

Configurations need to be selected based on the controller style you are using, not the light style attached to it.

  • RGB = Can be used with RGB and some RGBW Controllers (use WW slider near bottom for White Channel, MUST leave CW slider at 0)
  • RGBW = RGBWW = set all 5 channels at once as supported on RGBWW and some RGBW Controllers
  • RGB+WW = Set White channels then set color channels, not sure if anyone needs this, but it was a legacy operation mode

Support / Thanks:
If you would like to thank the developer, donations of any value are welcome via Paypal. Please DM me for any support requests, bug/feature requests should be made in the main thread.

Further Background:
The DTH Name is based on something that was quickly abandoned by @steve_ledridge that I found on github
I found the best support of the interface from here:

Magic Home led controller device type?
Osram LIGHTIFY GardenSpot Minis rgb - aap version
Carrier Infinity / Bryant Evolution compatibility?
(Derek Scritchfield) #2

Have you seen this project… no man I’m middle and it works with the arilux brand MI home controlers… [RELEASE] SmartLife (H801) RGBW LED Strip Wifi Controller & Bulb

(Ph4r) #3

I sure have, but it requires custom firmware and other hardware to load it and isn’t compatible with the controller I bought. Also, life is about choices, and this is another option that can be easier WHEN I can send raw tcp data and remove the Man-in-the-Middle.

(Aaron Davis) #4

I have which uses the same software, excited to try this out didnt want to deal with hardware mods.

(Ph4r) #5

Cool, let me know how you get on with it.

(Weston T Turner) #6

@ph4r We’re you able to try your solution out/ update it to be able to handle RGBW strip lights?
If I were to send you a set of them from Amazon. Would you be willing to expand your solution to be able to handle the RGBW style strip lights?

I love what you have done by the way!!-- I also don’t want to deal with hardware mods etc., just a software solution with a little time (I just don’t have the technical skill you have shown ;-(

1 Like
(Ph4r) #7

Since I don’t have any of those, I did not implement the White Channel (or channels such as a RGBWW strip). The only controller that I have is permanently installed in the ceiling of my media room. I would not mind a little autumn project to add RGBW or RGBWW support to this DTH with some provided hardware. There are a few things from the JPElectron documents I’m not clear on such as if you can issue direct control of the White Levels commands in combination with the RGB Channels.

(Weston T Turner) #8

@ph4r. Awesome. Are you based in the US? If so PM me your details and I will shoot some hardware your way. I am just trying to make everything I own only reliant on SmartThings… I have a nice system here at the house but I feel it is too “scattered” between platforms…And I don’t want to spend 60+ dollars on the zwave Fibraro controller, that’s just ridiculous to me.

1 Like
(Weston T Turner) #9

Could you help me get your system set up on my pc. I am not understanding how to install the additional packages that you request for the cygwin install. When I go to search for gcc, git, or make, there are like 100 packages that come up for the gcc (none show only “gcc”, all 100 show “gcc” in the title somewhere so I am getting confused on what I am really supposed to be doing)

I have set up my 4 controllers with static ip addresses on my home network in the format of 192.168.1.XXX.

So I guess what I’m not understanding is how to configure the tcptunnel, and the make tcptunnel. Also how is your ip address a 10#? Mine is a 192#.

Thank you for spending time to help me get this setup like yours. I’m sorry for not being very knowledgeable in this.

I do have the DTH loaded in the IDE and I do have the devices created.

1 Like
(Ph4r) #10

Sure, I’ll pm you in a little bit and we can work through it.

(Weston T Turner) #11


Thank you so much for your help.

I am getting somewhere now, I have those 3 commands installed git, make, gcc.

But I just don’t know what I am doing so this is going so slow (And I imagine this is a 10 min process for someone that knows what their doing)…

Do you have teamviewer (free version)? I could PM you a temporary connection.

(Ph4r) #12

Due to a kind donation from @Wtstreetglow, I now have a RGBW strip and have updated this DTH to support RGBWW strips in the base form! The whites adjust simultaneously with the color channels, and the Whites can be adjusted even while a color animation is running!

If someone has interest in a color temperature changing Whites implementation, I think I would need a RGBWW strip to verify with, but for now you should be able to adjust both White Channels with individual sliders and that are governed by the overall device brightness.

(Ron Talley) #13

I have this Controller and rgbww strips. I use them for under cabinet lighting. I actually just use a GE Smart Switch connected to an outlet that the wall wart is plugged into. Since the Controller remembers the last state it was in before power loss, it’s been working out perfect.

However, I sure wouldn’t mind using the cool colors and dancing lights feature when listening to music. For the music part, seems like you would still need the app? Any way, think I might give this a try.

Can the “middle man” run on a Pi3?

(Ph4r) #14

Yes, it totally can run on a Raspberry Pi3! Dancing Lights do still require the app running today. You could set this up to use for seasonal mood lighting via ActionTiles or Google Home.


Is there a way to run the Man-in-the-Middle program in background on raspberry pi3? Currently, I need to Putty into Raspberry Pi and then run the following commands for it to work.
$ cd tcptunnel
$ ./configure
$ make
$ ./tcptunnel --local-port=5577 --remote-port=5577 --remote-host=LED IP ADDRESS --log --stay-alive

Is it possible to start this when Raspberry Pi starts and stay on in background.

(Ph4r) #16

There are a bunch of init scripts you can use. You only need to configure and make the project one time after you git clone. After that, you can just run the program directly each time, you may need to include the full path to the file or move it outside of userspace if you have it in your home folder currently. In order to have it run in the background, put an Ampersand & at the end of the command like this:

./tcptunnel --local-port=5577 --remote-port=5577 --remote-host=LED IP ADDRESS --log --stay-alive &

Thanks adding Amperesand (&) at the end worked but when I close the Putty session the LED stops responding. To be clear, I just closed the session and did not shut down the Pi. Is there a way for it to run without having the session open?

(Ph4r) #18

Perhaps you didn’t see the link that I posted with it. You need to put the line inside one of the many scripts that fit your use case, here is another link that is perhaps more clear on the options available: Typically, the first one listed [rc.local] is what you want, but there are others if you wish to try them.

(Ph4r) #19

A user pointed out that I didn’t use the standard color for the ON state of this device which is now resolved in the repository.

(Paolo Barone) #20

I just tried and did not work for me… any idea how I can troubleshoot? I see the commands going to the TCP Tunnel but nothing happens with the lights