RGBW Strip Control Simply

Please could somebody simplify this YAML code into something with minimal YAML code…Basically I am trying to switch the code without the colour selector wheel etc…in other words I want to be able to select either red or white…depending on which selection is pressed…I don’t need sliders for brightness, colour selection etc
I can’t work out what to crop out or fix…

Thanks

  - platform: mqtt
    name: "RGBW LED STRIP"
    command_topic: "cmnd/RGBWSTRIP/POWER"
    state_topic: "tele/RGBWSTRIP/STATE"
    state_value_template: "{{value_json.POWER}}"
    availability_topic: "tele/RGBWSTRIP/LWT"
    brightness_command_topic: "cmnd/RGBWSTRIP/Dimmer"
    brightness_state_topic: "tele/RGBWSTRIP/STATE"
    brightness_scale: 100
    on_command_type: "brightness"
    brightness_value_template: "{{value_json.Dimmer}}"
    white_value_state_topic: "tele/RGBWSTRIP/STATE"
    white_value_command_topic: "cmnd/RGBWSTRIP/White"
    white_value_scale: 100
    white_value_template: "{{ value_json.Channel[3] }}"
    rgb_command_topic: "cmnd/RGBWSTRIP/Color2"
    rgb_state_topic: "tele/RGBWSTRIP/STATE"
    rgb_value_template: "{{value_json.Color.split(',')[0:3]|join(',')}}"
    effect_command_topic: "cmnd/RGBWSTRIP/Scheme"
    effect_state_topic: "tele/RGBWSTRIP/STATE"
    effect_value_template: "{{value_json.Scheme}}"
    effect_list:
      - 0
      - 1
      - 2
      - 3
      - 4
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    qos: 1
    retain: false

Why not hide the light entity and introduce a couple of scripts to turn the light to red or white?

Ok thanks for the feedback…and how might I achieve that using the scripts…that’s where I get stuck

Assuming your light is called light.rgbw_led_strip, something like this

script:
  turn_red_on:
    sequence:
       service: light.turn_on
         data:
           entity_id: light.rgbw_led_strip
            color: red

Thanks for that…
I entered the code into the configuration yaml…
then executed it but it didn’t work

There will be logs. What do they say?

Error executing service <ServiceCall script.turn_red_on (c:43b8409faff3427c93caa7844318b6ee)>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1150, in _safe_execute
    await self._execute_service(handler, service_call)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1163, in _execute_service
    await handler.func(service_call)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/script/__init__.py", line 114, in service_handler
    context=service.context)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/script/__init__.py", line 172, in async_turn_on
    kwargs.get(ATTR_VARIABLES), context)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py", line 131, in async_run
    await self._handle_action(action, variables, context)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py", line 210, in _handle_action
    action, variables, context)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py", line 299, in _async_call_service
    context=context
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 89, in async_call_from_config
    domain, service_name, service_data, blocking=blocking, context=context)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1121, in async_call
    processed_data = handler.schema(service_data)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 267, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 589, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 427, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['color']

I looked again at the docs and I apologise but it should be color_name - see https://www.home-assistant.io/components/light

1 Like

Thank you so much for helping me…There is absolutely no need for apologies…I am very grateful…The script now works perfectly…I will now fine tune the rest of the script to do other things…
Thanks once again…