WLED with Smarthings

@Kevin_Montanez

Alright…first of all I cleaned up the code above. There was some formatting issues (> signs in front of each lines).
All you have to do is:

  • In the SmarThings IDE, go to “My device handlers”
  • Create new device handler
  • From Code
  • Paste the code
  • Click Create, then save and Publish for me

Then, click on “My devices”, and

  • New device
  • Give it a name (Desk lamp or whatever)
  • Copy name to Device Network ID
  • Type go all the way to the bottom to find WLED
  • Select your location
  • Select your hub

Now this device will be available in the SmartThings app, open it.
Go to the settings gear, enter the IP address of the ESP8266 and port (80 by default)

That’s it, Smartthings (and Google Home) should be able to turn on/off, change color and brightness.

1 Like

@DaveUK83
Did you ever get it to work? I have a few deployed in my house and it is very very stable! Let me know if you still need help…

Thanks for your efforts on WLED. Works fine in SmartThings app with color wheel, brightness control and on/off switch.

Through no fault of yours, Alexa understands on/off and color commands, but brightness control Alexa is “ignorant”. Maybe she needs more time and training.

Have not tried webCORE yet, but don’t expect any problems.

Well done, thanks again.

How did u get past the error… I’m having the same issue

Thx

I copied the above device handler, exactly, and pasted into a new device handler.

All worked as indicated it would in SmartThings. Alexa does not handle brightness correctly.

Very pleased with result. Must also thank those who contributed to WLED, nice.

Same deal here. Device Type Handler installed no problem, new device added, no problem. Went to the device, set the IP address and can see where I can turn it off/on and change colors… the WLED just doesn’t seem to be responding to any actions I take in the device. Won’t turn on, off, etc. The WLED device works perfectly in the WLED app, and perfect in Home Assistant… just no dice in the SmartThings app. Any thoughts appreciated. Thanks!

Not sure this is relevant, but my device handler program is 124 lines long. Is yours? Are you sure you copied and pasted all of the program? I had to copy twice to catch the first two lines.

Make sure to pick the correct handler in IDE when setting up device. However, seems odd to me the “Name” and “Device Network ID” are the the same.

In my “Current States”, Switch on & Level are shown, but no Hue or Saturation are shown. Maybe ESP and SmartThings don’t communicate that or Color.

Whether important or not, I’m using the old version of SmartThings to add device and control the ESP8266 nodemcu WLED device.

In the SmartThings window there is on/off, level control 0 to 255 and a color wheel. All three work, except the brightness of LEDs top out at 100. I’m running a strip of 144 LEDs powered by a 5volt phone charger. So maybe under powered and not capable of 255 brightness level. May also be limited by the WLED program to 100.

Alexa can turn ESP on/off and change color, if basic RED, BLUE, GREEN, YELLOW, Etc commands. Brightness levels do not work. I think because the device’s name is too long and Alexa doesn’t wait for a full command.

If powered off and then powered on, the WLED/ESP defaults to two 72 LED segments running a forward effect and reverse effect. SmartThings can take over no problem. Using color wheel and brightness scale, you can pick color and brightness. Turn on and off no problem.

I created simple WebCORE piston and it controlled on/off, hue, sat, level. However, these changes do not show in SmartThings window. More experiments needed.

Change the port from 80.0 to 80

Not sure why I would have a decimal point in the port number… in any event, yes, I do have the port set to just “80”… still not working.

Thanks for helping others on this.

The reason the slider is 0 to 255 is because the “Master brightness” from the WLED doc has a range of 0 to 255. See first line “&A=” parameter from https://github.com/Aircoookie/WLED/wiki/HTTP-request-API
I can try to update the code to calculate the % value from the 0-255 range, round it/convert it to an integer to see if Alexa handles it better, but I have no issue with Google Home.

As far as the the wheel color picker, I couldn’t find a way to save the selected value (it will always go back in the middle) or get feedback from WLED when changed outside of ST. To simplify the task I decided to only send WLED hue and saturation values. I was having some issues sending the RGB colors, especially with Google Home. H/S is understood by all.

Lots of improvements could be made, as I made this quickly one night to fit my needs. I don’t really understand why others seem to have so much difficulty with it. I implemented quite a few around my house and have no issue adding them in ST.

Again, thanks for jumping in and helping others!

Are all your devices (ST Hub / ESP) on the same subnet? (192.168.1.X)
Did you look at the logs while trying to control the device from the ST app?

Also, to troubleshoot, and make sure that this is a device handler or not, simply open a browser, make sure you have access to the wled interface (IP:80).
On another tab, simply enter the following (change the IP to your ESP):
To turn ON: 192.168.1.X:80/win&T=1
To turn OFF:192.168.1.X:80/win&T=0

This is essentially all the device handler does. It passes urls to WLED following the HTTP API avalable here:

@MeudA Thanks for the assist. Yes, everything’s on the same subnet, and can hit those URL’s and they work. So, here’s the funny thing. I had port 80 in the Settings, but for the fun of it, based on @unpltd’s comment… I went in and set the port to 80.0. Then immediately set it back to 80. And that actually worked… no idea why, or I just got lucky… but it works now. Thanks again.

I do wish the device could 1) change the colors of the WLED device, and 2) show the proper status of the WLED device… for instance, if I turn it on in Home Assistant. In any event, I understand this was a personal project to meet personal needs, so beggars can’t be choosers. In any event, it’s certainly a huge step to have on/off functionality from within ST. Good job!

@triggerx
What do mean by 1) change the colors of the WLED device? This device handler should change the color without issue…
As far as the home assistant integration, do you not have ST integrated to HA? Since my instance of HA pulls directly from the ST integration the status is in sync (except the color wheel picker always going back to the center). But on/off and brightness are in sync.

I could not get the color to change. I touched a certain color on the color wheel, it would hang (loading spinner) for about 15 seconds and then put me back in the center of the wheel. No change was made to the WLED color.

Yes, I have ST integrated into HA. HA will reflect any state changes I set from this device handler, but not the other way around. For example, if I turn on the WLED from this DH, HA shows that it was turned on. If I then turn it off in HA, then this DH still shows it as being on.

I verified that the Device Handler was copied correctly. Since I have verified that sending on/off commands work, I know there’s communication between ST and the WLED… I guess at this point I’ll whack it all and try again. Thanks again.

MeudA,

I might suggest, if you don’t mind sharing, Aircookie has started a new forum. There maybe some SmartThings users join at some point.

Thanks for the info!

Created a post under Integrations here : https://wled.discourse.group/t/smartthings/103
(I also created a Github repository here https://github.com/damien67/WLED-SmartThings)

Also created a post for ambilight/hyperion mode under Projects: https://wled.discourse.group/t/wled-ambilight-hyperion/102

Hi . Thanks for making the device handler. It works great. My only issue is that the device is not found when trying to add it to webcore.
In settings, available devices, it just doesn’t show up to select.
Is this just me?
Anyone test this for me?

Thanks.

Hi, thanks for the DH for this.

If it helps anyone else, it’s taken me a few days to get it working - I could see the ESP from web browsers on other devices, but my v2 hub couldn’t, despite fiddling with IP and port fields.

The thing that solved it for me was adding a location and a hub to the device on the IDE; it’s not a mandatory field so I hadn’t included it.

Thanks so much to those who have contributed to this.

Ref brightness, it appears alexa is taking 100% brightness and passing it through as a value of 100 and not 255 or 50% and ‘50’ and not 127. I can imagine this is a simple change but don’t know enough about this language to complete the conversion in this code.

It would also be awesome if someone could take the time to work out how to pass an effect through if that is possible? Just a few of the basic onces then I guess we can modify as desired?