Device Handler for NodeMCU using MQTT?

If it is an analog RGB or RGBW LED strip, @vseven has already added support to ST_Anything to handle those. Getting Neopixels to work properly is another thing altogether. Allan could probably comment more and he is the ST_Anything RGB/RGBW SME.

Very long story short I couldn’t get the neopixel library to play nice with in the ST_Anything architecture. I’ve debated just making a very simple device Handler that does a post to the controller and pushes the color or command. This way you can use an existing neopixel library that runs a web server on the controller that is known to work. But I haven’t had time to try that way.

1 Like

@Ryan780
I’m building out the strips from this Bruh video: https://www.youtube.com/watch?v=9KI36GTgwuQ&feature=youtu.be

He’s got instructions on integrating with homeAssistant, and i do have HA and an MQTT bridge running, but i’d like to take HA out of the mix on these if i can.

I saw the ST_Anything stuff, but it seems like it is more geared towards making direct calls into the device (and fully managing the device as well) instead of dumping commands into a queue. I want to avoid rebuilding the Arduino sketch if i can, and since the sketch provided in the above video is based on control through an MQTT broker i’m hoping to stick with that.

I am fully prepared to create a completely new DTH for this, but it’s always easier to chop up something that’s already been created and tailor it to your needs than building something from scratch… so just hoping for any DTH out there that is already set up to put messages into a queue for me.

1 Like

There’s an MQTT bridge smartapp but I haven’t used it.

Yep, that’s what i’m using right now for my HA bridge… It will serve as the queue that controls the light strip… which is where the request for a DTH comes in.

I believe a viable temporary workaround while i get the DTH issue sorted is to use a simulated RGBW switch and let HomeAssistant control the lights (since you can customize the MQ payload in HA) after receiving a relay through the bridge… but that’s kind of a clunky workaround.

Just came across this. Might want to give it a look.

The method you linked to is quite literally just the HTTP URI DTH that’s available doing a GET command to the strips.

I believe I’m running the same software package on my ESP8266 unit that @TRDeadbeat is running. Likely “McLighting” or similar with MQTT, RestAPI and WebSockets

I’ve been eyeballing the SmartLife H801 SmartApp/DTH as a possible “source” for a DTH/SmartApp for this solution as it would basically operate very similarly to the solution @erocm1231 already has in place. I just don’t have development experience so I can’t make things do what I want without relying on others to build it.

+1…same boat here. My aspirations are much higher than my ability.

Well, one way or another, this DTH is happening :slight_smile: I’ll let you guys both know when i have something working @Ryan780 @Synthesis

It might take awhile, but i’ll get something going even if i have to write it from scratch.

4 Likes

I love you so much right now…

I have Neopixel strings everywhere in the house right now… Having them tied into SmartThings would add some amazing visual cues to home status… The lights flash red when you go to bed if you left the garage door open, etc.

1 Like

You can probably start with my DTH I made for ST_Anything RGBW control. Just find the line that says “parent.childSetColorRGB(device.deviceNetworkId, adjustedColor)” and replace it with your call:

Should at least get you started and works with color commands from Alexa/GH.

1 Like

This one is for analog RGBW strips though, right? This one is in the ST_Anything library already as child device type.

The device Handler is all the same, it doesn’t matter where the information is going. It doesn’t know that whatever you pick is being passed to an analog LED strip. All it’s doing is passing a hex value which can easily be changed to pass some other type of command. But it’s a good base as it will take the Hue and saturation numbers that Alexa or Google home pass in and convert them over to hex. It also has the standard Color Picker from SmartThings.

2 Likes

@vseven

This looks very promising actually! Thanks for the info… but i’m seeing some exceptions from the DTH.

When setting the color with the ST app using the preset colors, the log shows:
java.lang.NullPointerException: Cannot invoke method childSetColorRGB() on null object @line 242 (adjustColor)

When setting with Alexa i’m getting:

Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[class java.lang.Character]
[class java.lang.Number] @line 380 (hueToRgb)

Subsequent adjustments from Alexa do not seem to register until you make an adjustment inside the app.

Are these known issues or is there a dependency to this DTH that i missed? I just did a copy/paste on the code for the one DTH you linked and published it, is it part of a larger package that i should have installed, or is this perhaps due to there not actually being a physical device in place here? I’m using this DTH on a device that i added manually through the web API portal, since my device is not actually discoverable and only listens to MQTT.

A DTH is just sending sending/receiving info to/from a device. In my code its sending it to the ST_Anything parent device. Your going to have to modify it for whatever you are doing. As for the Alexa thing figure out the replacement for the childSetColorRGB and see if that works itself out.

1 Like

Why not? If you create a device based on that and then update the commands to no longer send to ST_Anything but a get or post command of some sort why wouldn’t it work? I don’t have a lifx bulb but I can add a new device based on that device Handler and it will appear in SmartThings and work correctly and accept Alexa commands without having the physical device. It just won’t control anything.

1 Like

Correct. The poster was looking to create a dth from scratch to do rgbw LED control. My dth already does a good majority of what they want. Therefore all they have to do is modify a couple little things and they should be set with a basic dth that they can use as a template to add whatever elae they want in.

1 Like

I’m not sure what you’re saying. The original poster did want a device Handler and didnt want to start from scratch. So I posted the basis of a RGBW device handler which, @TRDeadbeat can correct me if im wrong, is exactly what he was looking for.

1 Like

Okay…well, I am asking for something more easily controllable then…even if it’s not part of ST_anything because there’s no way I can start from scratch. LMAO

There isn’t anything more easily controllable.

I think you need to read up on the documentation and get a better idea of the relationship between a device Handler and an actual device.

1 Like