IKEA RGBW(W?) setting via automation and syntax

HA beginner here. Running 2022.11.0 front end 20221207.0 -latest via docker container on RPi 4.

I’ve managed to automate lights via sunrise and sunset and the IKEA parts are discovered and I can manually switch and change everything, brightness, CCT and RGB. However, I’m banging my head against a wall when it comes to CCT or RGB(WW) changes via automation. All examples I’ve found seems to use very different syntax than what’s created via “create automation”.

End goal here is to trigger color change based on electricity price to give my parents a visual indicator of when is a good time to start dishwasher, washing machine and tumble dryer without opening an app or web page.

Trigger on price works as intended, but somehow I’m only able to turn on/off and change brightness.

For example, this works:


alias: Electricity > 5 kr/kWh
description: Electricity is expensive
trigger:
  - type: value
    platform: device
    device_id: df257d44b4e11f9041a68ea866f071f3
    entity_id: sensor.nordpool_kwh_se3_sek_3_10_025
    domain: sensor
    above: 5
condition: []
action:
  - type: turn_on
    device_id: 075943509147aced97bdd27d1239d490
    entity_id: light.rgbw_matplats
    domain: light
    brightness_pct: 10
mode: single

However, if I try to add a new line after brightness_pct or change it to for example:

rgbww_color: [100,100,100,100,100]

Gives “Message malformed: extra keys not allowed @ data[‘rgbww_color’] error message. Same for rgb and rgbw.

Examples I find here and around the web uses to me very different syntax with service and data_template, so I’m lost.

Am I able to use the automatically generated automation scripts to change anything but on/off or brightness?

Thanks in advance!

Rather than using a device turn on action, have you tried using a light turn on action instead?

Something like this maybe!

service: light.turn_on
data:
  rgbww_color:
    - 100
    - 100
    - 100
    - 100
    - 100
  brightness: 180
target:
  entity_id: light.rgbw_matplats

Edit: Added pic to show how it would look in the ui.

1 Like

Thanks!

How did you get that magic menu to appear?

I tried to indent the YAML code.


alias: Electricity > 5 kr/kWh
description: Electricity is expensive
trigger:
  - type: value
    platform: device
    device_id: df257d44b4e11f9041a68ea866f071f3
    entity_id: sensor.nordpool_kwh_se3_sek_3_10_025
    domain: sensor
    above: 5
condition: []
action:
 - service: light.turn_on
    data:
      rgbww_color:
      - 100
      - 100
      - 100
      - 100
      - 100
      brightness: 180
      target:
        entity_id: light.rgbw_matplats
mode: single

Same error message as before: “Message malformed: extra keys not allowed @ data[‘data’]”.

Your indentation is incorrect

I suspected my indentation. The key here was your suggestion to use Service Light:turn on.

If anyone have a similar problem and is fighting the YAML, here is a working example:


alias: El > 3 kr/kWh
description: El > 3 kr/kWh
trigger:
  - type: value
    platform: device
    device_id: df257d44b4e11f9041a68ea866f071f3
    entity_id: sensor.nordpool_kwh_se3_sek_3_10_025
    domain: sensor
    above: 3
    below: 4
condition: []
action:
  - service: light.turn_on
    data:
      transition: 3
      rgb_color:
        - 252
        - 103
        - 3
      brightness_pct: 33
    target:
      device_id: 075943509147aced97bdd27d1239d490
mode: single

Thank you very much rossk!

1 Like