[OBSOLETE] Magic Home WiFi LED Control

The new app currently doesn’t support custom DTH

Thanks for getting back to me so quickly ph4r,

So I just put the following into the rc.local file?

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

Will that then work? If not could you please advise as to what I should add and where? The tcptunnel directory is on the top level of home so cd /tcptunnel opens the directory containing the cloned goodies.

Also is there another file (other than the rc.local) that will start the script after the bootup has completed. I don’t want to screw up my bootup sequence because of my noob idiocy!!

Your help and advice is much appreciated. When running in a command prompt this works like a dream and has even enabled me to successfully add the RGB LED light to actiontiles too.

#legend

I would suggest full pathing the cd command with either the tilde ~ or the path from root just to be sure it executes properly. I’d say just make a backup of your SD Card before hand and if it does seem to do something bad (not expected) you can just replace the SD Card image.

That fixed the issue. All is working well. Thank you.

1 Like

Thanks so much that has worked a treat. I used a sudo -s command in the rc.local file and then cd /tcptunnel and the ./tunnel line and that seems to have done the trick. A few reboots later and it does seem to be tested and functioning.

I also made a backup disk image of my pi so can bring it all back up in case of an SD card disaster. Top tip!

Thanks so much ph4r you are a legend!

1 Like

No pressure, but there is a donate link in the first post if you are so inclined.

1 Like

I have finally got around to installing the lights on my Kitchen Cabinets. Plugged the LED controller in, my router assigned it the correct IP address. But no, smart things control. Determined that the script was no longer running. At some point my NAS had lost power. Docker came back up, executed the centos image which runs tcptunnel. Does anyone have any advice as to how I could force centos to launch the tcptunnel service on boot?

Thanks,

See the posts directly above from @DJMellow where he added three lines into the end of his rc.local file.

Hi Ph4r

I will gladly donate if you can help me get this working on my Mac - the problem is that this is like a different language for me - I’m really stuck at the tcptunnel part, I simply don’t know what to do to get this going - keep getting - tcptunnel missing local port option ???

I’ve inputted : tcptunnel —local port = 5577

Oh, maybe I should have read some of the posts since my last visit to this thread. Thank you, Ill try this out later.

1 Like

what do we use for the network id?

well i just took the last 4 of the mac address.

just needs to be unique I believe.

I’m not sure which field you are referencing, but the one called “deviceNetworkId” gets populated by the DTH with the Hex-Encoded IP address and Port number you specify in the settings.

Just to let you all know, Ph4r was kind enough with his time to set up the tcptunnel for me … I was having issues on how to set it up , he was able to get it going in a matter of minutes, although he said he’s not a “Mac Guy” , it was no problem to him and he got it running on my MacBook and now I can sleep again - also amazing to see him lashing out the code on Terminal and it is awesome to see a developer who is still supporting his work and helping Noobs like myself !!! Thank you so much !!!

3 Likes

Just a quick post to mention I have the same results as ingenium13 - I can turn the strips on/off and also send commands for (at least some, didn’t try all) the custom modes (eg. fade 7). Setting a straight color has no effect. Also using a MagicHome controller and 5-pin RGBW light strip.

Try another “Controller Style” under the Gear Icon. If colors do not work under any of the styles listed then we will need to capture packets from Magic Home to see what is going on with your setup. Since you mentioned RGBW - Check that you are able to control the White Channel with the slider way down at the bottom of the page as well.

Are there any additional instructions for steps 1 to 4? There seems to have been a few people not understand them fully.

I’m using Cygwin and tried searching for “gcc, git, make” but as another posted has mentioned, there are tons of results. Which do I need?

I’m assuming step 2 means run the following once I have the correct bits installed?

$ uname -a
CYGWIN_NT-6.1-WOW64 computer 1.7.25(0.270/5/3) 2013-08-31 20:39 i686 Cygwin

$ git clone GitHub - ph4r/tcptunnel: A simple TCP port forwarder.
$ cd tcptunnel
$ ./configure
$ make
$ ./tcptunnel --version
$ ./tcptunnel --help
$ file tcptunnel.exe
tcptunnel.exe: PE32 executable (console) Intel 80386, for MS Windows

Step 3. Make a TCP tunnel. How is this done?

Step 4. I’m assuming this is also done in Cygwin once all the above is done?

Unfortunately, due to limitiations in the SmartThings platform, this is a bit of an advanced installation, but I’ll try and help you get it going. If you need more support, send me a message with a TeamViewer invite and we can sort it out together.

I’m not able to pull up my environment at the current time to help direct you on which packages to select on your Cygwin install. Adding more than you need is generally OK.

Step #2 and #3 are included in that snippet as listed on GitHub (see that some of the lines start with “git clone,” “configure,” and “make” as listed in my above steps.

The additional information on how to use Step #4 is listed under it above on the line that looks like what I have below, and the description of the things you need to change immediately under that.

./tcptunnel --local-port=5577 --remote-port=5577 --remote-host=10.10.10.103 --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.

Thanks @ph4r for all of your hard work! I’m curious if anyone has thoughts on the best way to automatically run tcptunnel on bootup. I’m using Windows and have created a scheduled task for each of my LED Controllers. It’s simple but it appears to work pretty well, but I’m open to suggestions… I should also note that I installed tcptunnel in the “bin” folder. You may need to replace “tcptunnel/tcptunnel” with “home/(username)/tcptunnel/tcptunnel”

For anyone else looking to create a scheduled task in Windows, below is my “Actions” syntax

Program/script: C:\cygwin64\bin\bash.exe
Arguments: -l -c “tcptunnel/tcptunnel --local-port=5577 --remote-port=5577 --remote-host=172.16.2.53 --log --stay-alive”
Start in: C:\cygwin64\bin

1 Like