LED MQTT_JSON colour change on trigger re, grenn and yellow

I have been flowing the MQTT JSON LED Pourch Light example by Bruh, I have got my LED strip to work and have it using MQTT i can switch it on and off and i have managed to turn the lights red…,

I am trying to make 3 automation to turn the LEDs red, green and yellow on a trigger, the trigger will be a google calendar entry. I am going to install the lights in my home office so that the family know if they can entre based on how important the work i am doing is. At the moment I am trying to trigger the LED colour change manually to check the system. I started with the red code and it worked my LEDs are now red, so i added the green code and now i get a configuration error and I can’t change the colour of the lights as i don’t get the switch on the ‘overview page’. the error I get is “Error loading /config/configuration.yaml: mapping values are not allowed here. ( it did work first time) in “/config/configuration.yaml”, line 90, column 12” .It is the “action:” line in the first automation. Can any one point me in the right direction this is my first build… I wont lie I am very happy to of got this far :slight_smile:

Thanks in advance.

‘’’'light:

  • platform: mqtt_json
    name: “Porch Strip”
    state_topic: “bruh/porch”
    command_topic: “bruh/porch/set”
    brightness: true
    rgb: true
    optimistic: false
    qos: 0

automation:

  • alias: “Strip LED Red”
    initial_state: False
    hide_entity: False
    action:
    • service: mqtt.publish
      data_template:
      topic: “bruh/porch/set”
      payload: ‘{
      “state”: “ON”,
      “brightness”: 120,
      “color”: {
      “r”: 255,
      “g”: 0,
      “b”: 00
      },
      “transition”: 1
      }’
  • alias: “Strip LED Green”
    initial_state: False
    hide_entity: False
    action:
    • service: mqtt.publish
      data_template:
      topic: “bruh/porch/set”
      payload: ‘{
      “state”: “ON”,
      “brightness”: 120,
      “color”: {
      “r”: 0,
      “g”: 255,
      “b”: 0
      },
      “transition”: 1
      }’
  • alias: “Strip LED Yellow”
    initial_state: False
    hide_entity: False
    action:
    • service: mqtt.publish
      data_template:
      topic: “bruh/porch/set”
      payload: ‘{
      “state”: “ON”,
      “brightness”: 120,
      “color”: {
      “r”: 255,
      “g”: 255,
      “b”: 0
      },
      “transition”: 1
      }’

your automations cant just have a action a script is better suited for that example here … this package is the bruh code also https://github.com/Vasiley/Home-Assistant-Main/blob/master/packages/kitchen_undercabinet_leds.yaml#L261

1 Like

Thanks i will see how i get on after digesting this code … :slight_smile: it looks very similar to what i want to do, i just use a calendar instead of dimmers.