ESPHome Light Effects?

Hi everybody,

I recently included ESPHome into my home-assistant setup. Currently it mainly controls LED strips, merely because most sensor (currently) run on zigbee.

They have some nice example effects for individually addressable strips like the WS2812, but those are all a bit basic. I was wondering if some people here have some custom effects that they’d like to share.

First thing that came to mind was a Knight Rider like effect that I had seen somewhere before (but that was before my home-assistant days, so I didn’t look into it further). But generally any kind of custom effect would be interesting to me.

I don’t have any custom effects myself yet, but if I come up with anything, I’ll share it here. Hopefully other people will share their effects as well :slight_smile:

1 Like

I would be interested in anything regarding led strip control with ESPHome as for me nothing is working :smiley: will wait for your tests

1 Like

I’ve seen the lamba stuff but never played with it, from the pages it looks pretty powerful.

1 Like

There is a whole thread on this, use the search.

That’s great @nickrout

Do you have a link? I searched multiple times before posting this and did not find a single collection thread containing light effects. Perhaps I used the wrong search terms, but I tried multiple combinations of esphome, light(s), effects, templates.

2 Likes

Have been searching for a thread with this as well, any link?

1 Like

I have been trying to find a link once again, but still no success. Please share the link with us @nickrout as you were able to find it somehow while the rest of us where not.

@fillwe @skvarnas @cooljimy84: I have not been able to create any ESPHome light effects myself that are worth mentioning. Pretty much just copying, pasting, modifying the examples from the esphome website. However, there is a project on github called WLED, which features (as of today) 79 different effects and 46 palettes out of the box.

I have flashed it to a nodeMCU and connected a WS2812 LED string (1 meter, 60 LEDs, running on 5V and <1A). There are pros and cons with this

PROs

  • large amount of effects
  • really nice effects
  • “customized versions” of effects (sorry, not a native speaker… I mean that you can use an effect such as scanner, which is similar to the ESPHome scanner: all leds off except one, that one will move around the LED strip. You can define what color your want to use for this. Also you can set a “secondary color” for effects with two customizable colors)
  • palettes (see below)

CONs

  • currently mqtt control isn’t the greatest
  • not easily integratable with Home Assistant (due to mqtt control)
  • unstable wifi (at least for me); I had ESPHome on that very nodeMCU and in the exact place (= distance to WiFi router) and it worked fine. The WLED, however, constantly loses WiFi connection, and sometimes does not re-connect to WiFi until unplugging it and plugging it back in

The main CON imho is that the device was -unlike the ESPHome- not designed to work flawlessly with Home Assistant (or I am just incapable of setting it up correctly, which is possible as well). While you can control the effects fine, there is no simple way to also control the palettes. That wouldn’t be see bad, but there are some other settings (circling through effects and/or palettes, if I understand correctly) that “overwrite” manual changes. For example, I set the strip to one particular effect when turning on. When I then change the effect and / or static color, it will eventually disconnect from WiFi and -if it manages to reconnect- start with that first effect instead of saving it’s current state.

When you control the device via it’s webUI, it works fine. You can set effects, pair them with palettes (or use regular colors), change brightness, etc. etc. just as you’d expect. Only when it loses connection you are pretty much screwed. I have this in the bedroom and need to unplug it at night to assure that it won’t randomly turn on in the middle of the night.

Fortunately there is a “but”. It seems like the developer and some enthusiasts are currently working on better Home Assistant integration!! You can find the github issue here. There is also a fork of the project, which I have yet to test to see whether that one works more reliably. Please keep in mind that at least the constant disconnecting might be due to my personal WiFi setup (though I wouldn’t understand this because the ESPHome worked fine using the exact same hardware and being placed in the exact same location).

Maybe this helps some of you. I am still interested in custom ESPHome light effects, but if they manage to integrate WLED better into Home Assistant, I will use that for my LEDs. ESPHome is great for other things (just as Tasmota is), but the out-of-the-box features of WLED are really amazing - it just needs to work more reliably and I’ll flash it to all my LED controllers :slight_smile:

1 Like

I am sorry that I can’t find the thread I was thinking of, most frustrating.

If you are not married to ESPhome there are some suggestions here that include McLighting running on an ESP with home assistant mqtt integration and 55 effects:

1 Like

I found the mclighting to be rather flacky, just random lockups, didn’t support transitions on or off (slow fade on or off) ended up making a nodered flow to select the effect of fade up, then set it to solid after a few seconds (as it then fades off again with that effect)

2 Likes

Thank you @tom_l I have flashed the original and the fork (as the original project is not being developed any longer). Started with the fork. It won’t work. The webUI won’t load. It’ll go up to 10%, then 67%, then there’ll be an error. Subscribed via mqtt and saw that it will always go Offline - Ready - Online… then right back to offline. Either there is something wrong with the project, or I made a mistake. To minimize the risk of me screwing up, I compiled the firmware without changing anything (first attempt I added my mqtt broker credentials etc. to the config file). Neither worked.

Then I tried the original firmware. It works fine, however, it doesn’t support mqtt (or at least I didn’t see an option to enter my credentials in the webUI configuration).

Both times my LED strip didn’t work as expected, either. This might be due to the LED strip itself; though I am using three of the exact LED strip with nodeMCU and nodeMCU board (ESPHome, Tasmota, WLED), so I wouldn’t understand why this would be. I’ll try to get my hands on another strip to see whether that one works. The project itself looks really cool, now it just has to work right ^^

@cooljimy84 I have considered node-red as well. However, my previous home automation was mostly node-red (and some ioBroker) and I wanted to switch to Home Assistant for good. I assume a Home Assistant scene or script could do what node-red can as well, correct? I will give McLighing another shot later today. Hopefully it works. If not I’ll see what other options I can find for this. I have to say that ESPHome works the best for me, so if there was a way to gather some nice effects for it, I’d just stick with that.

1 Like

I wish I could find the info I have referred to earlier. In the meantime this looks like it might meet your needs https://github.com/timmo001/ESP8266-MQTT-JSON-Lights

Thank you! This looks pretty cool. I will give it a shot once I got replacement LED strips as the new ones I ordered won’t work with any controller (ESPHome/WLED/McLighting) even though I am already using the same model with the same hardware (nodeMCU and nodeMCU board) without any problems. MQTT-JSON-Lights seems to be a great compromise as it offers fewer effects, but therefore integrates much better with Home Assistant.

UPDATE: @nickrout do you use this yourself? I cannot build the firmware. It will throw errors (details here) that I cannot understand. The best I might do is debug python on beginner level, but C is nothing I can work with at all. Instructions are pretty clear: clone repo, rename setup-file to setup.h, enter credentials, build. Did that, no success.

I don’t know how to install the libraries manually, but from what I understand, Platformio does this anyway, and I am running the most recent version (just upgraded after the first unsuccessful test).

In case you (or anybody else reading this) are using ESP8266-MQTT-JSON-Lights, were you able to compile the bin successfully, and if not, what did you do in order to fix any errors?

No I don’t use it, I found it when I was looking for the esphome stuff.

Just in case anybody had the same issue and their binary would not build… I changed the platformio.ino to

[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps = 
    ArduinoJson@~5
    PubSubClient
    WS2812FX
monitor_speed = 115200
build_flags=
    -Wwrite-strings

Compared to the original file I added the build_flags and specified which version of ArduinoJson to use for compiling. Before I did this, the compiler was using v6 and could not compile this code because syntax had changed between versions (if I understand correctly).

It compiled! I flashed it and my (short test) opinion about it is:

  • nice effects
  • Home Assistant template file for controlling anything (including extra slider for speed)
  • constant WiFi disconnects just like WLED¹
  • no webUI; while this doesn’t matter to people used to mqtt this is fine²

¹ when I flash ESPHome to any of my nodeMCUv3 with nodemcu-board, it will work flawlessly. Currently I just productively use one, but it has a switch, two relays, and an LED strip attached and I cannot complain at all. With any other of the mentioned projects, I constantly have issues with WiFi connectivity. This cannot be a hardware issue, but it is also hard to imagine that any developer other than the ESPHome one is not capable of decent connectivity… Are any of you using both ESPHome and one of the mentioned projects and has had similar issues? Or an idea why this might be at all?

² While I used the tasmota webUI for a long time, I have tried using mqtt for it exclusively. But I still have the habit of browsing a new devices IP address in Firefox to see if flashing worked; of course there was an error because this project doesn’t include an HTTP server. So this isn’t really a minus, just something I noticed and thought I’d mention for users that might not know how else to check for a device other than using the browser :wink:

Someone just marked my post above as offensive or something, which brought me back to the thread. Anyway, there seems to be quite a buzz around the builder/automation community about wled at the moment.

It’s very good. And getting better. Frenk has a lot of it integrated into home assistant already too.

1 Like

I agree! WLED has improved so much over the past few version (they seem to be working quite hard on complete Home Assistant integration).

I wish there was a way to include all WLED effects in ESPHome so that one could have this imho best led controller (because of the many effects and patterns), yet include other sensors like temperature measurement or PIR in one single device. I have a WLED in the living room, but there is also an ESPHome because it works with sensors that WLED obviously doesn’t (because it is not designed to!! I am aware of this and definitely not bashing on WLED, it is amazing, just saying it’d be even more awesome if something would combine both projects into one so that it’d more than just a light controller :slight_smile: ).

3 Likes

Ditto, where I have lights I have sensors, ESPHome is what I use, but I also flash WLED first to try the new effects…

Now what would be cool is an input on HA which say looked like a grid - you selected the dots on the grid and then a colour … full customisation! Sounds mental right - but the goal would be to have different colours for different notifications.