I adapted the awesome McLighting code to talk to Home Assistant via MQTT Light. This can be improved by adding MQTT JSON component, but this is my naive attempt at this project. No more locking up of ESP8266 using Fast LED. Please have a look at the Arduino code and yaml files here:
Hey,
I took a look at the code. Sadly I am using a “WS2801SO” strip that includes a clock. This was useful when I was using it together with a pi, but unlike the FastLED libary the McLighting code does not seem to have a possibility to set a clock pin.
Did I overlook something?
Best
You are right, FastLED does support vast variety of LED strip types. McLighting uses Adafruit’s neopixel library and ws2812fx for effects, so it only supports Neopixels (ws2811, ws2812, ws2812b, ws2813). I’ll look into Adafruit’s library to see if there are other implementations. Do you face locking up of your esp8266 with ws2801so strips? I thought the problem was isolated to only Neopixels and esp8266.
There is a port of Adafruit ws2801, https://github.com/r41d/WS2801FX unfortunately I don’t have a ws2801 led strip to test it. I’ll see if I can make a version for you to try.
Cool.
Yes, I experience the same issues as other people. Namely the LEDs turning after some apparently random time. For me only disconnecting the power to the board helps.
@Rudertier I have created something for you to try. https://github.com/debsahu/McLighting/tree/feature/ws2801. Check the Wiki on the libraries you need to install, including https://github.com/debsahu/WS2801FX. I forked the later from r41d user on github (https://github.com/r41d) who mentions a few limitations of this library including a few issues with animations. Let me know if this works for you.
Sorry for reacting so late. Sadly I do not find time yet to test this. It is still on my todo list and I’ll let you know how it worked, once I tried it.
@debsahu
Thanks for your Versions of McLighting/tree/feature/ws2801 + WS2801FX library.
I’ve testet the latest versions…
and my problem is that I can not adjust the speed via the web interface.
1-255 doesnt change the speed
0 = full speed, which actually corresponds to the speed of 255
When i switch to mode2/Breath, all LEDs turn off, an now i have to select another mode an reset the esp8266 board to bring it up again.
do you have an idea what my mistake is?
Thanks for the feedback, looks like the original library had issues with “breath” effect as well. The thing is it calls the brightness of strip every few cycles creating the effect, which brings up the following. You mentioned that brightness is not working, which has also been reported by original developer to be not using standard (sloppy) adafruit’s implementation. I’ll see if I can fix it, no guaranty though as I don’t have this step to test it out.
I fixed the speed for ws2801fx (https://github.com/debsahu/McLighting/tree/feature/ws2801). It was scaling between 10-65535 for ws2812fx and ws2801fx scales between 0-255. Change
long ws2812_speed = mcl_speed * 256;
to
long ws2812_speed = mcl_speed;
in request_handlers.h
Thank you very much,
you solved it! 8)
I added that before the value returns, because in my view: 0 = slow, 255 = fast
.
.
ws2812_speed = map(ws2812_speed, 0, 255, 255, 0);
return ws2812_speed;
I tried to give this project a go (to see the comparison between this and the bruh version) but I think I am through with NodeMCU boards. I have 3 can’t get any of them to upload the sketch just constant espcomm errors.
espcomm errors have nothing to do with the code. Use short good quality USB cables and reduce your upload baud rate to 115200.
No i wasnt blaming the code just never have been able to get the boards to upload. I have tried 4 or 5 different cables and never had the baud rate above 115200.
I believe the particular boards I bought are junk
I have one suggestion, if you have a CP2102 USB 2.0 to TTL UART Module 6Pin Serial Converter connect 5V to VIN, GND to GND, RX to TX and TX to RX. While holding flash, press reset on NodeMCU, this way the nodemcu will be in upload mode. Then upload code from Arduino, this is how I upload on some NodeMCU’s where the USB connector is physically destroyed!
First, thanks for the help.
Second, yes also tried using the uart adapter approach with these instructions from one Amz review of the board i purchased.
“The “reset” button resets the board (predictably) while the “flash” button is wired to GND0 and is the button for loading firmware data when used in a particular way. Press “Flash” and HOLD IT while you press reset and wait a few seconds for the reset light and then a couple seconds to boot, THEN release “flash” to get into the mode where you can upload firmware images.”
To no avail.
Still get the same errors.
Manually jump D3/GPIO0 to GND and reset, should put the ESP8266 on flash mode.
That turned the board LED on but that was about it. Same error.
Good news: I switched to one of the other boards and got it to work with the uart/hold flash/press reset method!
Bad news: nothing came up on the serial monitor after upload completed and nothing is showing up as an AP to connect to when looking at my phone’s wifi networks.
But thank you for your help getting the nodemcu into boot mode.
I tried to make the switch from Bruh’s setup to @debsahu fork of McLighting for WS2801 recently, since the Bruh setup was randomly turning itself off…
I had a fully working setup previously so cloned the github of @debsahu and worked through the dependencies so it would build - i can successfully compile and upload to my WeMos D1 Mini, but then when i reset the board I cannot see it on wifi.
As far as I can tell, i should see a new network named ESPxxxxx to connect to and configure my real wifi password etc…
My WeMos onboard led lights blue for about 3-4 seconds, then off for a second and back again…
Anyone know what I might be missing here ?
Ok, so I’ve managed to get the wemos connected to my wifi (I reset the wifi settings, using the commented out bit of the code for wifi manager… I assume wifi settings must be retained between flashes?)
Anyway, the board now connects to my network and the leds light up and cycle through colours automatically.
I am unable to get it to respond to any MQTT commands via homeassistant however…
I’ve edited my config to include the items listed in the example code, but if I try to turn the lights of using home assistant there is no response, and the switch toggles back to off after a few seconds.
I also installed the MCLighting APK on my phone, but I’m unable to set any solid colours using it… I can toggle some of the effects, but it’s unreliable.
I don’t believe the issue is wifi related as I am very near the AP and I can see a good signal in my wifi configuration page.
Any thoughts ?