Bruh LED configuration question for automation section

Hi Community,

OK, I am just starting with getting into HASS.IO. I got into this because I would like to get into more home control and automation.

Right now, it’s just control. Later, automation…

Here is my project. I want to put ambient exterior lighting using LEDs on the exterior of my house. I plan on installing these under my eves, for both security and ambience. Sick example…

I am very versed on the HW and electrical aspect of all this. I have had a job in technology for the past 20 years but I’ve never seemed to pick up development. I’ve dabbled in it but just enough to be dangerous. LOL.

Bruh_Automation has some really great examples and I’ve been pouring over all the code samples.

Here is one thread that has been very helpful to me:

Here is where I am at:
R-pi3 running latest version of HASS.IO – 0.61.1
HiLetgo ESP8266 NodeMCU LUA CP2102 ESP-12E – loaded with Bruh LED sample code and connected to network
Visdoll 16.4Ft WS2812B 300Leds RGB Pixel Strip Lights, 60 Pixel/m WS2811
ALITOVE 5V 60A 300W Power Supply Transformer Adapter Converter

Used touliloup’s example and created a separate “Packages” directory and included “packages: !include_dir_named packages” under the homeassistant: section in the configuration.yaml

Underpackages, I’ve included a separate: exteriorleds.yaml which has:

light:
  - platform: mqtt_json
    name: "House Top Eve"
    state_topic: "rasperry/topeve"
    command_topic: "rasperry/topeve/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

input_number:
  animation_speed:
    name: Top Eve Animation Speed
    initial: 150
    min: 1
    max: 150
    step: 10
  strip_brightness:
    name: Brightness
    icon: mdi:brightness-7
    initial: 150
    min: 1
    max: 150
    step: 10

When I start HASS.IO, log into the HA webpage and check the “Configuration” → “General” → “Configuration Validation button” it gives me a valid configuration.

Here is the issue.

When I include the automations section of those samples in the community help linked above, I get a ton of configuration errors.

On the main home page of the HA webpage is states:

So, I go back to the “Configuration Validation Button” and it says:

I cut and paste the code and made just a few changes to the alias and topics.

automation: 
  - alias: "Top Eve Animation Speed"
    initial_state: True
    hide_entity: False
    trigger:
      - platform: state
        entity_id: input_number.animation_speed
    action:
      - service: mqtt.publish
        data_template:
          topic: "rasperry/topeve/set"
          payload: '{"transition":{{ trigger.to_state.state | int }}}'

Here is the kicker… I also loaded Configurator: The browser-based configuration file editor for Home Assistant.

It’s telling me that the YAML looks good?

Questions:

  • I am assuming that I need the automation to actually publish changes that I make in the animation speed and brightness to the ESP8266?
  • What is wrong with the automation configuration?

Any help with the configuration would be greatly appreciated!!!

Sincere thanks.
-W

Edited for code blocks

You may need automation old: instead of automation: for the way you are doing it.

Thanks!

So, is there a better way to do this vs an “old way” assuming that automation style has changed for formatting in YAML?

-W

The new way is the automation editor and the old way is the way you have done it, I prefer the old way as the automation editor mangles the code making it hard to read and fix.

Thanks again. I appreciate the insight.

when i put in automation old instead of "automation in the exteriorleds.YAML file and rerun the configuration validation tool, it states this:

what am i missing?

Also, I am struggling through the code. One of my questions is I am assuming that I need the automation to actually publish changes that I make in the animation speed and brightness to the ESP8266?

Appreciate the help!!

Hmm I didn’t realise you had it in a package, you probably can’t do automation old: in a package. I have all my automations in automation.yaml which is called with automation old: !include automation.yaml as a standard include in the configuration.yaml

Yep that’s what the publish line does :slight_smile:

ok, it’s still throwing errors at me… Gonna need some time to look into this more for the new styles. Ugh.

I’ve did the following:

  • Added “automation old: !include automation.yaml” as you stated.
  • I’ve moved the contents of exteriorleds.yaml to the configuration.yaml file.
  • Commented out the “packages: !include_dir_named packages” the configuration.yaml file.
  • Put my animations in the animations.yaml file and deleted them from the exteriorleds.yaml file.
automation: 
  - alias: "Top Eve Animation Speed"
    initial_state: True
    hide_entity: False
    trigger:
      - platform: state
        entity_id: input_number.animation_speed
    action:
      - service: mqtt.publish
        data_template:
          topic: "rasperry/topeve/set"
          payload: '{"transition":{{ trigger.to_state.state | int }}}'

Configurator still throws this:
2018-01-21 16:58:23 ERROR (MainThread) [homeassistant.config] Invalid config for [homeassistant]: [automation old] is an invalid option for [homeassistant]. Check: homeassistant->automation old.

You can’t have the automation: inside the automations.yaml file you already stated it in the configuration file.
Also try it without the old, maybe hass.io doesn’t need it.

One other thing payload: should be payload_template:

Thanks for all your help Keith! Rock on man!

I removed the automation from automations.yaml as you suggested (still learning formatting)…

  - alias: "Top Eve Animation Speed"
    initial_state: True
    hide_entity: False
    trigger:
      - platform: state
        entity_id: input_number.animation_speed
    action:
      - service: mqtt.publish
        data_template:
          topic: "rasperry/topeve/set"
          payload_template: '{"transition":{{ trigger.to_state.state | int }}}'

That worked so tried and i repacked the lights in exteriorleds.yaml and uncommented the “packages: !include_dir_named packages”.

I reran the configurator and boom! Valid Config!

I had the “automation: !include automations.yaml” included in the homeassistant section and removed it to place in the bottom of the file.

homeassistant:
  name: Home
  latitude: redacted
  longitude: redacted
  elevation: 800    
  unit_system: imperial
  time_zone: redacted
  customize: !include customize.yaml
  packages: !include_dir_named packages

introduction:
frontend:
config:
http:
updater:
discovery:
conversation:
history:
logbook:
map:
sun:
sensor:
  - platform: yr
tts:
  - platform: google
cloud:
mqtt:
  broker: core-mosquitto
  username: redacted
  password: redacted

group: !include groups.yaml
script: !include scripts.yaml
automation: !include automations.yaml

Breakthrough!!!

Thank you for your help! I am glad i reached out to the community and you answered!!

-W