c0ntax
(Martin)
1
I have the below script to turn one light off and three others on to different colours but when config checking it results in errors.
I’m not sure what I’ve done wrong or what to do to correct it. Can someone please advise?
sunset_master_bedroom:
alias: Sunset Master Bedroom
icon: "mdi:weather-sunset-down"
sequence:
- service: light.turn_on
data:
- entity_id: light.headboard
brightness: 80
rgb_color:
- 131
- 50
- 168
transition: 120
- service: light.turn_on
data:
- entity_id: light.m_bedside
brightness: 80
rgb_color:
- 219
- 57
- 63
transition: 120
- service: light.turn_on
data:
- entity_id: light.r_bedside
brightness: 80
rgb_color:
- 209
- 96
- 158
transition: 120
- service: light.turn_off
data:
entity_id: light.bedroom_light
ronytomen
(Tony)
2
Try this instead… 
sunset_master_bedroom:
alias: Sunset Master Bedroom
icon: "mdi:weather-sunset-down"
sequence:
- service: light.turn_on
data:
entity_id: light.headboard
brightness: 80
rgb_color:
- 131
- 50
- 168
transition: 120
- service: light.turn_on
data:
entity_id: light.m_bedside
brightness: 80
rgb_color:
- 219
- 57
- 63
transition: 120
- service: light.turn_on
data:
entity_id: light.r_bedside
brightness: 80
rgb_color:
- 209
- 96
- 158
transition: 120
- service: light.turn_off
entity_id: light.bedroom_light
The elements within the data:
block are not a list -
, but a dictionary of key: value
.
Also, entity_id
is one of those “special” keys that can be defined outside the data:
block even if you have a data:
block.
1 Like
c0ntax
(Martin)
3
That sorted it.
Thanks for your help, Tony, it’s much appreciated.
1 Like
tom_l
4
Unfortunately, this is a bit inconsistent. See this issue:
1 Like
ronytomen
(Tony)
5
Fair point, I forgot about that pain… 
I have avoided it for the most part or had a WTH moment when it happens…
c0ntax
(Martin)
6
Thanks, I’ll bear that in mind but, in this case, the code works for my Hue lights.
It’s confusing and I wasn’t aware of this conflict but I’ll try and remember to move the entity_id if I encounter future issues and see how it goes.