el.rafar
(El Rafar)
January 17, 2024, 12:00pm
1
Hello from Brazil everyone! First time posting!
I just bought and WRGB LED ceiling light for the baby room and wanted to change the color and brightness of this light based on the time of day. I’m using the following script but getting repeated Message malformed: extra keys not allowed @ data[‘script’] errors on the YAML editor. Any tips what I’m getting wrong ?
Thanks for the help!
script:
set_light_color_brightness:
sequence:
- choose:
- conditions:
- condition: time
after: ‘18:00:00’
before: ‘22:00:00’
sequence:
- service: light.turn_on
target:
entity_id: light.9f5466ae0b24e618611f98674264d0f1
data:
rgb_color: [230, 184, 175]
brightness: 160
- conditions:
- condition: time
after: ‘08:00:00’
before: ‘18:00:00’
sequence:
- service: light.turn_on
target:
entity_id: light.9f5466ae0b24e618611f98674264d0f1
data:
rgb_color: [255, 255, 204]
brightness: 210
- conditions:
- condition: time
after: ‘22:00:00’
before: ‘06:00:00’
sequence:
- service: light.turn_on
target:
entity_id: light.9f5466ae0b24e618611f98674264d0f1
data:
rgb_color: [46, 61, 73]
brightness: 120
- conditions:
- condition: time
after: ‘06:00:00’
before: ‘08:00:00’
sequence:
- service: light.turn_on
target:
entity_id: light.9f5466ae0b24e618611f98674264d0f1
data:
rgb_color: [255, 241, 224]
brightness: 180
123
(Taras)
January 17, 2024, 1:59pm
2
Regarding the script code you posted, in which file is it located?
If it’s not in configuration.yaml
, remove the first line containing the word script:
NOTE
There may be syntax errors in your script but no one can tell for sure because you posted it as unformatted YAML. Refer to the following FAQ guideline:
Format it properly
el.rafar
(El Rafar)
January 17, 2024, 2:24pm
3
Really Sorry… still learning to use code and the HA Forum
Without the script now I’m getting this error on the editor:
Message malformed: extra keys not allowed @ data[‘set_light_color_brightness’]
set_light_color_brightness:
sequence:
- choose:
- conditions:
- condition: time
after: '18:00:00'
before: '22:00:00'
sequence:
- service: light.turn_on
target:
entity_id: light.9f5466ae0b24e618611f98674264d0f1
data:
rgb_color: [230, 184, 175]
brightness: 160
- conditions:
- condition: time
after: '08:00:00'
before: '18:00:00'
sequence:
- service: light.turn_on
target:
entity_id: light.9f5466ae0b24e618611f98674264d0f1
data:
rgb_color: [255, 255, 204]
brightness: 210
- conditions:
- condition: time
after: '22:00:00'
before: '06:00:00'
sequence:
- service: light.turn_on
target:
entity_id: light.9f5466ae0b24e618611f98674264d0f1
data:
rgb_color: [46, 61, 73]
brightness: 120
- conditions:
- condition: time
after: '06:00:00'
before: '08:00:00'
sequence:
- service: light.turn_on
target:
entity_id: light.9f5466ae0b24e618611f98674264d0f1
data:
rgb_color: [255, 241, 224]
brightness: 180
123
(Taras)
January 19, 2024, 1:47pm
4
Which editor are you using? Which file are you editing?
Tip:
If you are unfamiliar with YAML you should use Home Assistant’s native script editor (in visual mode).
Settings > Automations & Scenes > Scripts > Add Script