Giter VIP home page Giter VIP logo

esp-mqtt-json-digital-leds's Introduction

ESP MQTT JSON Digital LEDs

This project shows a super easy way to get started using Digital LED strips with Home Assistant, a sick, open-source Home Automation platform that can do just about anything.

The code covered in this repository utilizes Home Assistant's MQTT JSON Light Component and an ESP8266 microcontroller.

Supported Features Include

  • RGB Color Selection
  • Brightness
  • Flash
  • Fade
  • Transitions
  • Effects with Animation Speed
  • Over-the-Air (OTA) Upload from the ArduinoIDE!

Some of the effects incorporate the currrently selected color (sinelon, confetti, juggle, etc) while other effects use pre-defined colors. You can also select custom transition speeds between colors. The transition variable in Home Assistant (HA) also functions to control the animation speed of the currently running animation. The input_slider and automation in the HA configuration example allow you to easily set a transition speed from HA's user interface without needing to use the Services tool.

The default speed for the effects is hard coded and is set when the light is first turned on. When changing between effects, the previously used transition speed will take over. If the effects don't look great, play around with the slider to adjust the transition speed (AKA the effect's animation speed).

OTA Uploading

This code also supports remote uploading to the ESP8266 using Arduino's OTA library. To utilize this, you'll need to first upload the sketch using the traditional USB method. However, if you need to update your code after that, your WIFI-connected ESP chip should show up as an option under Tools -> Port -> Porch at your.ip.address.xxx. More information on OTA uploading can be found here. Note: You cannot access the serial monitor over WIFI at this point.

Demo Video

Demo Video

Tutorial Video

Tutorial Video

Parts List

Wiring Diagram

alt text

Home Assistant Service Examples

Besides using the card in Home Assistant's user interface, you can also use the Services tool to control the light using the light.turn_on and light.turn_off services. This will let you play with the parameters you can call later in automations or scripts.

Fade the Light On Over 5 Seconds - light.turn_on

{"entity_id":"light.porch_strip",
"brightness":150,
"color_name":"blue",
"transition":"5"
}

Flash The Light - light.turn_on

{"entity_id":"light.porch_strip",
"color_name":"green",
"brightness":255,
"flash":"short"
}

Call Rainbow Effect with Slow Animation Speed - light.turn_on

{"entity_id":"light.porch_strip",
"transition":"50",
"brightness":255,
"effect":"rainbow"
}

Fade the Light Off Over 5 Seconds - light.turn_off

{"entity_id":"light.porch_strip",
"transition":"50"
}

esp-mqtt-json-digital-leds's People

Contributors

bilalasd avatar brahmafear avatar bruhautomation avatar cribbstechnologies avatar dramamoose avatar fohdeesha avatar haleefacts avatar landrash avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp-mqtt-json-digital-leds's Issues

cant set led effect in automation.

cant set led effect in automation. it works fine if without any effect defined.
code blow

  • alias: switch ledon
    trigger:
    platform: event
    event_type: click
    event_data:
    entity_id: binary_sensor.switch_158d000XXXXXXX
    click_type: single
    action:
    service: light.turn_on
    entity_id: light.ledstrip1
    data_template:
    brightness: "250"
    color_name: "white"
    transition: "1"
    effect: "solid" only works fine after comment this line. no any log pop up

MQTT loses connection

Need help, Great code but it crashes after a period of time. It loses connection with MQTT and the only way to bring it back is to reset the sensor completely only for it to last for a short period of time and do exactly the same thing.

Hassio Issues

Ok everyone I really could use your help. I tested my entire rig for voltage 3.3v, 5v, and 12v. Everything has power and is hooked up correctly. Double checked my voltage for data and it too requires 5v, which it is feeding. The nodemcu is getting the data packets. There is 12v power at the end of the light strip, so it must be in my config with home assistant or Arduino.
Here is RGB lights in RGB.yaml file:
te_topic: "bar/shelves"
command_topic: "bar/shelves/set"
effect: true
effect_list:

  • bpm
  • candy cane
  • confetti
  • cyclon rainbow
  • dots
  • fire
  • glitter
  • juggle
  • lightning
  • noise
  • police all
  • police one
  • rainbow
  • rainbow with glitter
  • ripple
  • sinelon
  • solid
  • twinkle
    brightness: true
    flash: true
    rgb: true
    optimistic: false
    qos: 0
    #slider
    input_number:
    animation_speed:
    name: Animation Speed
    initial: 150
    min: 1
    max: 150
    step: 10
    Here is the Arduino programming:
    /*
    .______ .______ __ __ __ __ ___ __ __ .. ______ . . ___ .. __ ______ .__ .
    | _ \ | _ \ | | | | | | | | / \ | | | | | | / __ \ | / | / \ | || | / __ \ | \ | |
    | |) | | |) | | | | | | || | / ^ \ | | | | ---| |----| | | | | \ / | / ^ \ ---| |----| | | | | | | | |
    | _ < | / | | | | | __ | / /\ \ | | | | | | | | | | | |/| | / /\ \ | | | | | | | | | . | | |) | | |\ -.|–’ | | | | | / _____ \ | --' | | | |–’ | | | | | / _____ \ | | | | | --' | | |\ | |_____/ | _|.| _/ || || // __\ _/ || _/ || || // __\ || || ___/ || __|
    Thanks much to @corbanmailloux for providing a great framework for implementing flash/fade with HomeAssistant https://github.com/corbanmailloux/esp-mqtt-rgb-led
    To use this code you will need the following dependancies:
    Support for the ESP8266 boards.
  • You can add it to the board manager by going to File -> Preference and pasting http://arduino.esp8266.com/stable/package_esp8266com_index.json into the Additional Board Managers URL field.
  • Next, download the ESP8266 dependancies by going to Tools -> Board -> Board Manager and searching for ESP8266 and installing it.
    You will also need to download the follow libraries by going to Sketch -> Include Libraries -> Manage Libraries
    FastLED
    PubSubClient
    ArduinoJSON
    /
    #include <ArduinoJson.h>
    #include <ESP8266WiFi.h>
    #include <PubSubClient.h>
    #include “FastLED.h”
    #include <ESP8266mDNS.h>
    #include <WiFiUdp.h>
    #include <ArduinoOTA.h>
    /
    *********** WIFI and MQTT Information (CHANGE THESE FOR YOUR SETUP) /
    const char ssid = “xxxx”; //type your WIFI information inside the quotes
    const char password = “xxxx”;
    const char mqtt_server = “xxxx”;
    const char mqtt_username = “xxxx”;
    const char mqtt_password = “xxxx”;
    const int mqtt_port = 1883;
    /
    *************** FOR OTA ************************/
    #define SENSORNAME “barshelves” //change this to whatever you want to call your device
    #define OTApassword “yourOTApassword” //the password you will need to enter to upload remotely via the ArduinoIDE
    int OTAport = 8266;
    /
    MQTT TOPICS (change these topics as you wish) /
    const char light_state_topic = “bar/shelves”;
    const char light_set_topic = “bar/shelves/set”;
    const char
    on_cmd = “ON”;
    const char
    off_cmd = “OFF”;
    const char
    effect = “solid”;
    String effectString = “solid”;
    String oldeffectString = “solid”;
    /FOR JSON/
    const int BUFFER_SIZE = JSON_OBJECT_SIZE(10);
    #define MQTT_MAX_PACKET_SIZE 512
    /
    FastLED Defintions ********************************/
    #define NUM_LEDS 300
    #define DATA_PIN 5
    //#define CLOCK_PIN 5
    #define CHIPSET WS2811
    #define COLOR_ORDER BRG
    #define MILLION 1000000
    byte realRed = 0;
    byte realGreen = 0;
    byte realBlue = 0;
    byte red = 255;
    byte green = 255;
    byte blue = 255;
    byte brightness = 255;
    Any help would be great.

Non existing effect not ignored (current effect freezes)

Example: run the effect "rainbow". Then secondary, run a non-existing effect, like "rainbowz". The animation "freezes". It's only the animation that freezes, not the system. Once you select an existing effect, that works.

Juggle animation running on 240-ish to full brightness crashes the strip on version Apr 11, 2017

Hey guys,

well the title says it all. I noticed that when you're on full brightness and you switch to juggle animation, the strip shuts down. Initially I thought this only happens at 255 brightness, but it starts somewhere around 240 I think...

At first I thought this is a logic level shifter problem so I replaced the MOSFET shifter with a TI 74HCT125N, which is considered top notch... Problem persists.

Now while this has too much LEDs for your power supply written all over it, I'm asking nonetheless... Can anybody confirm?

BTW: I have a 5V 10A power supply for 100 WS2812B LEDs, which I thought should be sufficient.

Cheers
Ralph

Effects stop after a while

Solid light are working great but all effects stop working after a while (between 5 and 10 minutes) and the leds become black. Did anyone else encounter this problem?

Thank you for your support!

Unable to turn strip off when running certain animations on version Apr 2, 2017

Hi there,

Here is another issue I encountered:

When you are on cyclon rainbow or lighning, turning the strip off from the HA gui has no effect. The HA gui updates to off but the animation on the strip keeps going. One has to hit on again, change the animation to something other than cyclon rainbow or lightning and then switch the strip off. In this case the strip goes dark.

Cheers
Ralph

No Hardware SPI Pins Defined

Latest code from here, latest FastLED. When compiling the sketch for NodeMCU I get the following:

In file included from /Users/john/Documents/Arduino/ESP_MQTT_Digital_LEDs/ESP_MQTT_Digital_LEDs.ino:29:0: /Users/john/Documents/Arduino/libraries/FastLED/FastLED.h:17:21: note: #pragma message: FastLED version 3.001.003 pragma message "FastLED version 3.001.003" ^ In file included from /Users/john/Documents/Arduino/libraries/FastLED/FastLED.h:65:0, from /Users/john/Documents/Arduino/ESP_MQTT_Digital_LEDs/ESP_MQTT_Digital_LEDs.ino:29: /Users/john/Documents/Arduino/libraries/FastLED/fastspi.h:110:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output" ^ Sketch uses 264731 bytes (25%) of program storage space. Maximum is 1044464 bytes. Global variables use 36100 bytes (44%) of dynamic memory, leaving 45820 bytes for local variables. Maximum is 81920 bytes. Uploading 268880 bytes from /var/folders/tc/j87mr7r54r5_c2vr57wnwvzr0000gn/T/arduino_build_578265/ESP_MQTT_Digital_LEDs.ino.bin to flash at 0x00000000 ................................................................................ [ 30% ] ................................................................................ [ 60% ] ................................................................................ [ 91% ] ....................... [ 100% ]

However it does compile and does install and work. However the longest run I get is maybe 15 minutes tops. The strip either just shuts off, or freezes mid animation. A reset of NodeMCU clears it and restarts to Solid White. Haven't logged via serial monitor yet but seems to be replicating other known issues in the github issues section.

Unstable Behaviour of the light strip

Hello,

I recently made the light strip, I took the code here from github and compiled it for the Nodemcu v1.0.
Made the changes in Home Assistant and everything 'works'.

I only have one problem, I can switch on the light strip, choose an animation then after an amount of time the light strip goes out, when switching it on again it is white (not the previous animation).

The time between choosing the animation and switching off changes, it can be 30 seconds, it can be 15 minutes.

when compiling with arduino IDE 1.8.5 i see errors
pragma message "FastLED version 3.001.006"
pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"

My light strip is a WS2812B (thats what I think, at least the website where I bought the strip tells me ;-) )
so I put the WS2812B where WS2811 was

any idea's

Dirk

Lights don't work

Total newbie here so forgive me for asking stupid questions. I've tried to follow each step in the process and after getting everything installed on my pi and updating my Homeassistant yaml file and uploading the sketch to my board nothing happens. Homeassistant is showing the light card, the input card and the automation card but when I turn on the light nothing happens. Not sure if it's a communication issue with the ESP, or an MQTT issue or what. Is there a way to serially monitor what homeassistant is sending out and if it's communicating with the ESP? Totally stuck. Thanks for any help or guidance.

Celsius

Hey Ben,

How would I adapt the .ino file to show celsuis units?

Effect List no show

Effect List is not showing up in Home Assistant with the code that is provided. I can see the Input Number, Automation, and Light Boxes but no section for effects.

RGBW

Is there any support for RGBW

pasted the code but parseObject() failed! hint welcome!

First of all many thanks for sharing the code, i've been following your project for long time but i just now started to do something.
So, as in object i tried to control the nodemcu with mqtt and i got in the arduinoIDE serial monitor the "parseObject() failed" error.
Can you help me to fix it?

Thanks in advice!

Color green and blue mixed up?

Sending "color":"green" gives a blue light and this is printed in the console:
{"entity_id":"light.pixelring_strip", "brightness":150, "color_name":"green", "transition":"0" }
Message arrived [sensor/neopixelring/set] {"transition": 0, **"color": {"r": 0, "b": 0, "g": 128},** "state": "ON", "brightness": 150} solid Setting LEDs: r: 0, g: 75, b: 0

If I send "color":"blue", it gives green lends and this is printed in the console:
{"entity_id":"light.pixelring_strip", "brightness":150, "color_name":"blue", "transition":"2" }
Message arrived [sensor/neopixelring/set] {"transition": 0, "color": **{"r": 0, "b": 255, "g": 0}**, "state": "ON", "brightness": 150} solid Setting LEDs: r: 0, g: 0, b: 150

I have to go to bed now, so I dont have any more time to look at the issue at the moment.
However I think it seems as the recieved json object has G and B mixed up, eg:
Blue becomes: R G B
Green becomes: R B G

"color":"red" works fine, also "rgb-color":[0,255,0] etc. work fine.

Here is the red one that works:
Message arrived [sensor/neopixelring/set] {"transition": 0, **"color": {"r": 255, "b": 0, "g": 0},** "state": "ON", "brightness": 150} solid Setting LEDs: r: 150, g: 0, b: 0

Initial status

Thank you Ben, this is awesome rocketscience (still learning as i go).

I have managed to change the initial effect to fire instead of full-on white but struggle to find a way to change the initial state to ON instead of OFF. My goal is to have the strip light up as soon as the power is switched on and the esp8266 has booted up.
Where in the code can you change this?

sometimes works/doesnt work

i uploaded the code on esp8266 like 25 times and only 2 out of 25 it fired up. samenumbers same code.. anything bugged or what is going on?? on resetting the 8266 dos it loose the code or just resets the board?

OTA not functioning

I have tried uploading via OTA after initial flash and it will not accept the password. It just keeps giving me a popup with this error in the log below:

Traceback (most recent call last):
File "C:*PATH TO ARDUINO*\arduino-1.8.5\portable\packages\esp8266\hardware\esp8266\2.3.0/tools/espota.py", line 36, in
import logging
File "C:\Python27\lib\logging_init_.py", line 26, in
import sys, os, time, cStringIO, traceback, warnings, weakref, collections
File "C:\Python27\lib\weakref.py", line 14, in
from _weakref import (
ImportError: cannot import name _remove_dead_weakref

Light strip not lighting up.

I've got the circuit set up properly and the NodeMCU software was uploaded as well. I have the proper components and automations set up in Home Assistant and I can tell that the NodeMCU receives the proper command but the strip does not light up.

What kind of voltage/amps should I expect on the output pin? I'd like to confirm the output is working properly before I try to get a replacement strip from Amazon.

Thanks!

ESP8266 loses MQTT connection when setting effect or animation speed VER. 10 Apr 2017

I am using the example HA config and unmodified code (save for topics and network info)
When I set any effect besides Solid, subsequent commands do not work properly. Selecting a different color does nothing and turning the lights off causes the ESP to to set RGB to 0 several times and then lose connection to the MQTT server.

The only thing that seems to work properly is the animation speed set command.
Ironically, changing the animation speed before setting an effect causes the ESP to loop setting RGB to the same value some 1000 times (i/e)
Setting LEDs:
r: 255, g: 255, b: 255
Loop count: 82
Setting LEDs:
r: 255, g: 255, b: 255
Loop count: 83
Setting LEDs:
r: 255, g: 255, b: 255
Loop count: 84
Setting LEDs:
r: 255, g: 255, b: 255
Loop count: 85

Can't find the effect dropdown or toggle

Hi @bruhautomation , What do you mean when you say, "The effect dropdown will show up in the card for the light after you turn on the toggle."?

Can you please specifically explain both where and how to turn on the toggle.
Do I need to add any lines of code? I think I am overthinking this step which is probably super simple. Can you please help and provide as much detail as possible. I have tried every single command (is that what you call them?) in the developer tools/ services page of HA.

Thanks

HA color picker issue on solid animation on version Apr 2, 2017

Hey guys,

first of all let me thank you for your work on the sketch. It works like a charm!

Here's an issue I'm struggling with: When you pick a color, the bulb icon will reflect the picked color correctly, while the actual color being sent to the strip is the mirrored one from the color picker. (Kinda hard to explain actually...) Some examples..

Solid animation:

  • You pick blue

  • Bulb icon color: blue

  • Strip color: green

  • You pick yellow

  • Bulb icon color: yellow

  • Strip color: purple

It picks the mirrored color if you look at that HA color picker... I hope you get the idea.
I changed the #define COLOR_ORDER BRG to RGB but that screwed up all the colors in all other animations. Sort of expected at this point... I also tried the color picker on a Yeelight strip and a Yeelight bulb as well as on a LIFX bulb. Works as expected. Colors are selected correctly.

Now the question is, is this a HA MQTT JSON Light [color picker] thing, or is it a ESP-MQTT-JSON-Digital-LED thing?

Can you guys maybe confirm this behavior?

Cheers,
Ralph

MILLION / color_temp

i am getting this error

ESP_MQTT_Digital_LEDs:394: error: 'MILLION' was not declared in this scope

Test run via Mqtt Tools

I have successfully uploaded the code but failed to test run with mqtt tools like mqttLens, Fx or other mobile mqtt client app...what are the parameter i should pass from pub side.. tried pub on topic "light_set_topic" and
message {"entity_id":"light.porch_strip",
"color_name":"green",
"brightness":255,
"flash":"short"
}

obviously not correct one..no response from node mcu

Trouble on Data being sent to strip?

Hey all,

I'm super new to trying to get things connected over the internet, but this project seemed within my scope. I love any project with light strips and wanted to update my current set up to connect to Wi-Fi like Ben's, but I'm having a little trouble.

My set up was:
Arduino Uno (running Neopixel codes)
5V 10A power supply
WS2812B RGB LED strip

I know that Ben is using a 12V strip, but I thought that my strip being 5V would be less of a hassle. To get this project updated, I got a raspberry pi running hassbian with home assistant on it and that seems to be fine. I got a nodeMCU to replace the Arduino Uno and a logic converter for the data signal. The light strip powers up fine but I'm not sure what's going on with the data... I can't get it to respond from the commands from Home Assistant. My strip just lights up a solid blue-ish color and doesn't respond to anything. When I check the serial monitor on the Arduino IDE, it is completely blank. I feel that the issue has something to do with the nodeMCU but I can't place my finger on it. What could I be doing wrong? Data pin and ground on the light strip seems to get just under 5V (~4.9) and the power and ground on the strip are getting ~5.2V... I wonder if this could be the issue as well? Thanks in advance for your help guys.

mqtt light:

Hello BRUH:

I got this project working, but I had only one concern that would be very easy but I am unable to fix it.
I am trying to add 2 RGB lights but somehow on my home assistant it is only showing the last
Example
light:

  • platform: mqtt_json
    name: "FrontYard"
    state_topic: "FY/porch"
    command_topic: "FY/porch/set"
    effect: true
    brightness: true
    flash: true
    rgb: true
    optimistic: false
    qos: 0

    name: "BackYard"
    state_topic: "BY/porch"
    command_topic: "BY/porch/set"
    effect: true
    brightness: true
    flash: true
    rgb: true
    optimistic: false
    qos: 0

Can you/anyone please assistant me what I am doing wrong.

I had compile the code no error, home assistant load perfectly but LED Switch is showing only for BackYard.

thanks

AA

Memory when sending On command.

When you toggle the "off" switch on HA and turn it back on. Is it possible to make the NodeMCU display the same effect that it was before the shut down?
Currently it resets to solid everytime you toggle on and off. I've been looking through the arduino sketch and couldn't seem a way to implement it. Anyone else want it to operate this way? THANKS AGAIN FOR BEING AWESOME.

Fire effect doesnt work?

Hi i just noticed th at fire effect doesnt work..i mean the led lights up but its only white color plain. No red or any other color with effect
Anyone else having same issue with fire effect?

Fading the leds

When I try JSON, for example something like this:

{"entity_id":"light.porch_strip",
"brightness":150,
"color_name":"blue",
"transition":"2"
}

The transition does not take 2 seconds, but a lot more. I think that maybe the esp is too slow? Maybe it should increase brightness by 10, or 5? Additionally, you cant see it on video, but the transition is not fully smooth.
EDIT: And sometimes loop continues with:

Setting LEDs:
r: 0, g: 0, b: 0

several dozen, or even hundred times.

OpenHAB Setup

Has anyone gotten this setup with openhab? Im trying to set it up but not too sure how to go about it. Thanks

Very weak lights. NOT WORKING AT ALL

Hi guys.. NIce prject. I setup everything according to the tutorials here. I also get disconnects and my LED strip is just glewing weak red. I can see that it might get signal cause if i chose an effect lights start to flicker. But No color available nothing.

I dunno where to start troubleshooting. I have NodeMCU 1 with ws2811 strip.

Help appreciated :)

How do you go loop

Ok im trying to find out how these strips would go to loop. When i turn them ON they just solid white and dont go to loop (they supposed to?). The code is original,just copy and paste. Do i need to do loop via mqtt i wonder or how?

MSGEQ7 support

This is a nice chip which enables the possiblity to sync music with LED animations.
Would be awesome if this would support it.

Pragma Issues

Hey Ben,

So putting this together and it seems that the data is not being transmitted to the strips. I am getting this notice in the IDE upon upload. I can't tell what is going on except that the LEDs are not working.

In file included from C:\Users\jvalence\Desktop\Udemy\ledcloud\ledcloud.ino:25:0:

C:\Users\jvalence\Documents\Arduino\libraries\FastLED/FastLED.h:17:21: note: #pragma message: FastLED version 3.001.003

 pragma message "FastLED version 3.001.003"

                 ^

In file included from C:\Users\jvalence\Documents\Arduino\libraries\FastLED/FastLED.h:65:0,

             from C:\Users\jvalence\Desktop\Udemy\ledcloud\ledcloud.ino:25:

C:\Users\jvalence\Documents\Arduino\libraries\FastLED/fastspi.h:110:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output

 pragma message "No hardware SPI pins defined.  All SPI access will default to bitbanged output"

My setup is simple to test this. I am connecting my ESP8266 to cloudmqtt to test this before putting it in HA. I can see message publish to cloudmqtt and see messages publish to the ESP8266. Below is a sample message from the serial monitor.

Message arrived [strip/sub] {"state":"ON","color":{"r":50,"g":50,"b":50},"brightness":255,"effect":"solid"}

solid
Setting LEDs:
r: 50, g: 50, b: 50

Any ideas?

Justin

ESP "crashes" after setting effect

I've tried the code as-is and only changed the wifi and mqtt settings.

Without connecting the ledstrip to the ESP, only to test, the network connection is lost.
I start with 4 terminals:
1 to view serial output
2 continuous ping to esp
3 send mqtt command
4 view mqtt commands returning

When setting an effect with mqtt, after a few seconds the ping reply stops. The serial output says "Attempting MQTT connection...failed, rc=-2 try again in 5 seconds"...

When printing out the ip address in the process to reconnect mqtt, it says it still has it's ip address, whilst it isn't pingable.

I have this on my nodemcu developer board, and also on a esp-01.

Mqtt

If I use your script and didn't change any MQTT topics, how will a MQTT message needs look to trigger one effect?

I'm just trying to trigger the lights thru NodeRed.

Strip flickers towards the end

First of all, thank you for this amazing project. It is incredible how easy it was setting everything up and watch it come to life. Your YouTube channel is a great inspiration and my head is swarming with so many new ideas for projects. 🙂

Nevertheless, since I'm a rather newbie on things like Arduino and LED strips I have encountered some issues where I'm not sure where to look for the reason behind them and I'm looking for some help. If this is the wrong place than please let me know.

My setup is as following:

  • NodeMCU v3
  • WS2812B 5m LED strip with 60 LEDs / m (should be 300 in total, but I have not counted them)
  • MeanWell RS-150-5 power supply (130W, 5 Volts, 26 Amps)

The difference in my setup to this project is that my strip is using 5V instead of 12V, so I don't need the DC-DC converter. Also I'm not using a logic shifter to shift the data signal I get from pin D5 from 3V to 5V. Aside from that it's the same thing.

Now, when I switch on the strip with solid light everything is fine (well almost, the LEDs towards the end are noticably dimmer than at the beginning, but that should be solvable by injecting power half way through, I believe). But I do get solid colors and all LEDs light up (again, I'm not 100% sure since the strip is still rolled up on the coil it was delivered on).
Okay, solid works. But when I turn on animations, there is some visible flickering towards the end of the strip. This happens on all animations. What's more puzzling is that on animations where the light is traveling down (and/or up, like sinelon) the strip some LEDs don't light up on each loop.

The question I have is, what's the cause of this? A faulty LED strip, the NodeMCU or could it be a software error? Or is it as simple as the missing logic shifter?

Looking forward to your answers.

Lightning

If you have more than 255 leds the lighting effect doesn't work properly. If random8 is replaced with random16 it fixes the problem (unless you have 65,000 leds I guess)

Is some of this code missing?

Slowly but surely making progress on this awesome project. I am totally new to all this and it has been quite overwhelming. Still, I am pushing on and stoked. I have uploaded everything to my node, but can't see if works because I am missing some choices on my HA states page.

QUESTION: Is it me or is the current version of the Example Home Assistant Configuration.yaml missing a lot of lines? My HA screen is missing an effects list, on/off switch, and color selection. Can anyone check/ update what is missing please?

this is what I have so far from mixing and matching between the lines Ben has on the original video and the YAML.file on here. Any help/advice/suggestions would be hugely appreciated:

(MQTT stuff. Then:)

light:

  • platform: mqtt_json
    name: "Porch Strip"
    state_topic: "bruh/porch"
    command_topic: "bruh/porch/set"
    rgb_state_topic: "bruh/mqttstrip/setcolorpub"
    rgb_comand_topic: "bruh/mqttstrip/setcolor"
    brightness_state_topic: "bruh/mqttstrip/setbrightnesspub"
    brightness_command_topic: "bruh/mqttstrip/setbrightnes"
    effect: true

input_select:
porch_led_effect:
name: "Porch LED Effect"
options:
- bpm
- candy cane
- confetti
- cyclon rainbow
- dots
- fire
- glitter
- juggle
- lightning
- noise
- police all
- police one
- rainbow
- rainbow with glitter
- ripple
- sinelon
- solid
- twinkle
brightness: true
flash: true
rgb: true
optimistic: false
qos: 0

input_slider:
porch_animation_speed:
name: Porch Animation Speed
initial: 150
min: 1
max: 150
step: 10

automation:

  • alias: "Porch Input Effect"
    initial_state: True
    hide_entity: False
    trigger:

    • platform: state
      entity_id: input_select.porch_led_effect
      action:
    • service: mqtt.publish
      data_template:
      topic: "bruh/porch/seteffect"
      payload: '{"transition":{{ trigger.to_state.state | string }}}'
  • alias: "Porch Animation Speed"
    initial_state: True
    hide_entity: False
    trigger:

    • platform: state
      entity_id: input_slider.porch_animation_speed
      action:
    • service: mqtt.publish
      data_template:
      topic: "bruh/porch/set"
      payload: '{"transition":{{ trigger.to_state.state | int }}}'

Rainbow, Rainbow Glitter, BPM, and Ripple do nothing. New Update Break?

Hey, not sure if its because of a recent update to fastled or something, but the effects listed above do not work anymore. When they are selected, I can't turn the strip off or on (no digital signal seems to be sent to the strip). The serial monitor shows that the commands are being received correctly though.

If I change the effect to something else, i can turn it off and on again and the selected effect also works.

Any ideas?

The only thing changed was Fastled definitions and had to change .addLeds for some reason because it said the previous didnt exist.

#define NUM_LEDS 186 #define DATA_PIN 5 #define CHIPSET NEOPIXEL #define COLOR_ORDER BRG //old BRG int MILLION = 1000000;

and
FastLED.addLeds<CHIPSET, DATA_PIN>(leds, NUM_LEDS);

Random Flickering

Hey there, I have the exact same code set up, and I have my Home Assistant running on my pi.

I have MQTT up and functioning and requests appear to be received by the NodeMCU, I have the WS2811 Strip that you linked in your Description.
I am using 21 pixels = 63 Leds = 189 (63 * 3(rgb leds ))

I am not 100% sure how I am supposed to be calculating my num_leds but I have used each: 21, 63, 189

I am using an old XBOX 360 PSU, its 12V DC at 10AMPS.

I can see that when I change the animation speed it increase the frequency of the change in led randomness, solid does kinda work (usually appears as a rainbow), but when I send a command it appears to shift a color (doesn't always set it to the specified color even via serial) down the chain of drivers per pixel.

I have set up on my Arduino, and since it uses 5v logic it kinda worked, the colors would change for most of the strip to what i set it to, but other times it would only do half. (I was using a different library and a demo sketch to test the strip)

I have my code set to use the ws2811 chipset for the nodemcu.

I can only assume its an issue with the strip? I have read in some places that some WS2811 are driven by 5v instead of 12v.

I had purchased the LED Strip that was in the description, is there a chance i burnt out my chips?

I have tried to do this as well: http://hackaday.com/2017/01/20/cheating-at-5v-ws2812-control-to-use-a-3-3v-data-line/

Add some Lighteffects :)

Hi Mate I finally got it running. Yeah awesome!! My wife wow effect was just amazing! Thanks mate!

after googleling a bit i found that the author of some lighteffects u used also made some oter effects

https://github.com/atuline/FastLED-Demos

Would u mind to integrate them? I didn't really understand the code.

Would be awesome !!!

THanks for this more than awesome work!!!

Greeting from a happy happy man and also a happy woman from France :) 👍

No speed controll

I has trying to change the speed of an animation and nothing happened, I thought it was my config but it looks like it isn't in the arduino code

Infinite "Setting LED" a5dba60

When I set effect other than "solid" and I turn off leds I get output:

Message arrived [bruh/porch/set] {"state": "ON"}
?ěôţ?Ĺ“ @ěôţ?Ŕ�˙?i�ţ?SL @State
Message arrived [bruh/porch/set] {"effect": "lightning", "state": "ON"}
lightninglightning
Message arrived [bruh/porch/set] {"state": "OFF"}
? �˙?SL @State
Setting LEDs:
r: 0, g: 0, b: 0
Setting LEDs:
r: 0, g: 0, b: 0
Setting LEDs:
r: 0, g: 0, b: 0
Setting LEDs:
r: 0, g: 0, b: 0
Setting LEDs:
r: 0, g: 0, b: 0
Setting LEDs:
r: 0, g: 0, b: 0
Setting LEDs:
r: 0, g: 0, b: 0

And eps writes it until I turn on leds again.
Also as you can see, effect name is doubled.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.