Home Assistant Community

BRUH Led strip config

#1

Hi.
I’m trying to setup led strip as in Bruh’s youtube video, but without any luck.
I bought WS2812B led strip, 5V power supply and nodemcu v1.
I have flashed nodemcu, and i can see it appear on my wifi network.
The problem I have is with his configuration in home assistant. HA won’t start after I put his code in. Probably because of the HA version.
I’m curently on latest HASSIO (0.56.2).
Is there any other config I can use? Does anyone has working configuration.yaml file I can replicate?
Meybe some other nodemcu code to use? I would realy love to use those effects with the strip.

0 Likes

Esphomelib - A comprehensive solution for using ESPs with Home Assistant
#2

Simply replace input_slider with input_number (it was renamed in 0.55 )

0 Likes

#3

Already did that, but I’m still having trouble with the rest of the code.
My HA simply won’t boot after I restart HA.

0 Likes

#4

Please have a look at your log, what does it say?

Of maybe try to delete the input_number and automation block and see if your HA boot with simple the mqtt and light block.

0 Likes

#5

I have a seperate configuration for lights - lights.yaml, and separate for automations.yaml.
I have put his code in lights.yaml.
Where do I put input slider part of the code? under the lights.yaml?
I finaly managed to boot HA after i changed the names for the topic (it was the same as my MQTT username - probobly that’s why HA didn’t boot)

0 Likes

#6

Anywhere, in which file the code is, doesn’t really matter (as long as the files are in the packages folder).

But, for organization, I would advise you to create a specific file for each “object”.
For example, create a my_bruh_mqttt_light.yaml file, and put the light, automation and input_slider in it.
It’s easier than having to check 3 files to change the config of one object.

The mqtt configuration can stay in the main configuration.yaml of course as you only will declare it once.

0 Likes

#7

Not shure if I understand…
Can you give me an example how that file would look?
And how do I point to that file in configuration.yaml?
Can I create rgb_strip.yaml, and put all the code for it in that file? or?
Never worked with .json before, so realy can’t understand how it works?

0 Likes

#8

Also, I cannot see none of the effects options.
screenshot

Nothing happens when I click on effects…

0 Likes

#9

Sorry for the confusion, I meant yaml not json.

In your config folder you can create a packages folder, and add this entry in your configuration.yaml:

packages: !include_dir_named packages

Then any *.yaml file you create in the packages folder will be part of the configuration.

For example create an rgb_strip.yaml in the packages folder and include everything your lamp need:

light:
  - platform: mqtt_json
    name: "My super lamp"
    state_topic: "home/rgb1"
    command_topic: "home/rgb1/set"
    effect: true
    effect_list:
      - bpm
      - candy cane  
      - confetti  
      - cyclon rainbow  
      - dots  
      - fire
      - glitter  
      - 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_number:
  animation_speed:
    name: Animation Speed
    initial: 150
    min: 1
    max: 150
    step: 1

automation: 
  - alias: "My super lamp Animation Speed"
    initial_state: True
    hide_entity: False
    trigger:
      - platform: state
        entity_id: input_number.animation_speed
    action:
      - service: mqtt.publish
        data_template:
          topic: "home/rgb1/set"
          payload: '{"transition":{{ trigger.to_state.state | int }}}'

For you problem with the effect, the number of space in your file must be wrong, as it take brightness as an effect instead of taking the effect list into account.

0 Likes

#10

As a next step (when above is working), you can create a group in configuration.yaml, so that the lamp control and the animation speed control always stays together as one element:

group:
  my_super_lamp_group:
    name: "My super lamp group"
    entities:
      - light.my_super_lamp
      - input_number.animation_speed
0 Likes

#11

A last tip:
You will only be able to change the effect when the light is ON, so don’t wonder why you cannot change the effect if your lamp is not ON

0 Likes

#12

WOW! Thank you for explaining all that in detail, gonna try it out, and Ill report back the results.

0 Likes

#13

I’m getting error with packages folder:
General Errors:
- Component not found: packages
- Setup failed for packages: Component not found.

So, I created folder in config folder called "packages"
I have added this in my configuration.yaml:

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
sensor: !include sensors.yaml
light: !include lights.yaml
switch: !include switches.yaml
zone: !include zones.yaml
device_tracker: !include device_tracker.yaml
packages: !include_dir_named packages

And inside packages folder I have pasted all of the code for rgb strip.

0 Likes

#14

Sorry, my mistake, move the packages entry under homeassistant

In mine it looks like that at the beginning of my configuration.yaml:

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: !secret latitude
  longitude: !secret longitude
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 301
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: Europe/Berlin
  packages: !include_dir_named packages
0 Likes

#15

Yeah, that worked, seems like it’s indentation thing - it has 2 blank spaces before packages:

1 Like

#16

Well, this looks AWSOME! Thank you @touliloup!


Can’t test if it’s working, as I have to connect the strip (I’m at work atm).
One last thing… Is there a way to add effects and brightness the same way as Animation speed?

0 Likes

#17

Might be a way, but I’m not aware of it… it look the same for mine.

You’ll get effects and brightness settings in the RGB traka element once it’s ON, this is how it looks like (on smartphone):

0 Likes

#18

Awsome! I will be puting it all together later today, and report if it (finaly) works.

1 Like

#19

Finaly made some time, and wired all together - IT WORKS!! Woohoo!
But… Few problems.
I wired 160 leds (cca 2,5m) and i have some flickering issues when using effects.
Also it seems like my colors are off. When I pick red color, the strip turns green… Also when using brightness, sometimes it does dim the strip, and sometimes changes color instead…
I have 5v, 60W power supply, Nodemcu, and the strip. It’s wired like this:
Power supply + on Vin and - on gnd in nodemcu. Also +and- goes on the strip, and pin 5 from nodemcu goes in data on the strip. What am I doing wrong? Is the sketch for Arduino wrong when using ws2812B led strip?

0 Likes

#20

If the color are reverse, you might have to change the arduino sketch.
When you select green, does the strip turn red?

Also try adding a capacitor on the power line, the flickering problem might come from the power supply not being able to cope with the change of current consumption. A big capacitor on the power lines might solve that.
See here for example:

Also, did you put the needed resistor between the data pin on the strip and pin 5 of your nodemcu?

For more advice, you can check adafruit guide for their neopixel:

0 Likes