Haha, I think we’ve all realized that at some point or another - sometimes this feels more like a second job when I get home and less like a hobby
Don’t worry though - you will get the hang of it. My suggestion would be to start with the Demo configuration - there’s enough there to start with. Just comment out the stuff you don’t need yet, and change the sitemaps/rules and items to match your setup as time goes on. Also, definitely install the tail log viewer (from openhabian) so you can have the log open and scrolling live as you experiment (you’ll start seeing how the different pieces in OH interact, and also catch any errors that might be preventing your stuff from working).
Lastly, this forum is full of helpful people who won’t hesitate to answer any question (and won’t make you feel like a noob at that).
True! I just don’t know where to start. I got 2 Sonoffs relay thingy, 30 feet of RGB ws2812b led strip and many NodeMCU and 1 TPLink smart light switch on the way from amazon. I would love to be able to hook up all of that and make it work. I’m going to go through all the tutorials and beginners link I can find.
Hey Bartus, firstly thank you for your guides, videos, designs and overall excellent hard work on this. I have ordered 5 of the recommended NodeMCU from Aliexpress, 10 of your riser from PCBWay and 1 BTF 5m 30 LED strip from Amazon (Will expand up to 10 of everything once I have one working).
It’ll take about a month for everything to get to me in the UK but I have 2 questions whilst I’m waiting if you could assist?
And secondly for your 3D printed enclosure, do you know if there is a UK based printing company I could use or will I have to have them printed in the US and shipped here? I’ve only bought 1 3D printed thing and that was from etsy, so not too up on how it works.
Thank you for the kind words!! I love sharing my work and seeing others using it!
You’ve got the correct connector (DC plug) - don’t forget to tin the wires, as they seem to sit more snug in the terminal block rather than pull out.
As for getting the enclosure 3d printed, you have several options. The best/cheapest would be to find a local “maker” or “hacker” space, download the STL files from my Thingiverse page and have them print it for you. They should only charge you for the price of the plastic (for reference, a 1Kg roll costs ~$20 and could print at least 20 of these) and maybe for printer time, depending on the place. Option 2 would be to find someone local on 3dhubs.com or makexyz.com (but don’t let them charge you more than ~$10, this is a very easy print).
If you have problems getting it printed locally, let me know - I can do it for you for the cost of shipping and an adult beverage!
Enjoy and let me know how you make out with this, looking forward to seeing some photos of pretty LEDs!
Fantastic thank you, I’ll take a look around and see what I can find. The waiting on the shipping will be the hardest part for now… if only we had teleporters haha.
Can anyone here help with a problem I have with an ESP32 instead of an ESP8266? I am using bartuses code, and it works fine on a ESP8266 that I have (just some of the effects don’t seem to work). I have now tried porting the code to an ESP32, because I have a few of them lying around, and the devices crashes in a loop. I haven’t changed much on the code side, just the imports for Wifi and mDNS:
It looks like you’re hitting the watchdog timer (wdt) and the ESP32 is resetting…I wonder if the libraries you’re using may have different behavior on the ESP32 (I do have one, but haven’t tried it out on this code myself, yet)…let me look at what mine does and get back to you.
Hey @bartus - Thanks for your write up on this topic, despite a few setbacks I have now my first LEDs set up on my shelving controlled through OH
One thing I am unsure about though is the status of the items in OH - For example when you change the effect, it does not update on the UI, same with the intensity and the speed. Being very new to OH I am still trying to feel my way around, but is it possible to publish the status of the LEDS to the MQTT server each time a button is pressed so it updates? Is it a just a case of adding the subscribe topic to the item line?
For the FX for example, I tried this:
Number tvledright_fx "TV LEDs Right Fx" {mqtt=">[broker:home/leds/tvright/set:command:*:MAP(leds.map)],<[broker:home/leds/tvright/fx:state:default:*:MAP(leds.map)]" }
Where state topic is “home/leds/tvright” and set topic is “home/leds/tvright/set”, but it doesn’t seem to work, does the mapping function work with both pub and sub?
The map should work both ways, but the status string doesn’t contain the effect (it’s only sent out), You can pull out brightness/speed from the MQTT message, but need to update the item MQTT path, to access just that value. Try:
Number tvledright_brightness "TV LEDs Right Brightness" {mqtt="<[broker:home/leds/tvright:state:JSONPATH($.brightness)]" }
Since the MQTT status topic is a multi-line set of status items, and we need to pull out only the current brightness, the JSONPATH will pull that out.
That said, I never did this for my items - they seem to update whenever I make a change in my GUI/app. Are you making changes to the items via rules or something? Sending a “postUpdate” at the end of the rule should modify the status item…
Thanks for the reply, having a play around in the items/sitemap files and can get the number to appear as you described, but that also doesn’t update in the GUI, tried 3 separate devices and does the same on each of them - No changes to items or rules except from what is in your examples!
Ah, just the text shows? I think I know what the problem is there, you just need to format it into the item. So, for example:
Number tvledright_brightness "TV LEDs Right Brightness [%d]" {mqtt="<[broker:home/leds/tvright:state:JSONPATH($.brightness)]" }
That should format it as a number, and adjust the item state with it.
If that doesn’t work, I’d say the next thing to do would be to write a handler rule, based on the MQTT input string updating, and explicitly set the state for each item as you parse it out of the JSON string…
No, I didn’t. Easiest way was to just use an ESP8266 instead. There probably is a way to make it work with an ESP32, but I don’t really see the point for me. The 8266 is cheaper, and I don’t need the extra “horse power” and bluetooth for my LED controller.
Wondering if anyone would be able to point me in the right direction please? I have made the WS2812 LED strip with a NodeMCU. Everything loaded on fine. Connects to WIFi and MQTT server correctly. I added the items, sitemap, rules and transform additions to my openhab (latest version). The issue is that when trying to control the LED strip via openhab, all functions do not work. Observations are as follows.
-MQTT fx shows that the messages are being received.
-When connected to the Arduino Serial Monitor error reports “parseObject() failed” when power of fx is chosen.
-When manually publishing {“state”:“ON”,“color”:{“r”:255,“g”:255,“b”:255},“brightness”:150,“effect”:“solid”,“transistion”:0} I can use the colour picker to choose a colour and turn on/off.
-Latest libraries and boards loaded into Arduino IDE
-I feel that I have something missing as I am so close, it appears that openhab is not acting on the messages. I just am unsure what that is.
The questions I think I need help on are…
Is there any prerequisites I need installed in Openhab in relation to The JSON side of things?
Has anyone else had this issue?
Can you post your rule code? I’m thinking you’re just creating a faulty Json object…you can also subscribe with MQTT.fx to the led strip’s set topic, so you can see exactly what openHAB is outputting to the Nodemcu.
Ok, so, rereading your original post - you’re actually able to use the openHAB color picker to change colors/power status, correct? And, you’re seeing the MQTT messages that openHAB sends to the strip (whether it’s the power strip or color picker) in the “set” topic, right?
Can you post a couple of those messages? I’d like to see the difference between the mapped (Power/FX) and rule-built (Color/Speed/Intensity) JSON packets.
Finally, can you post the LED.map file, as well? The two controls you’re having problems with (Power/FX) have their JSOn strings built from the MAP file directly, so any formatting issues must be isolated to that file.