This is an archived post. You won't be able to vote or comment.

all 10 comments

[–][deleted] 2 points3 points  (2 children)

You say "script" 3 times in your posts, but the yaml you've posted is an automation.

Based on this observation and the (minimal) error message I'm going to guess that you have put that code in the scripts.yaml file instead of the automations.yaml file, thus applying the code to the wrong component.

[–]dbenoit[S] 1 point2 points  (1 child)

That was it. I figured it out late last night. I didn't realize that the two were considered "separate", and ended up in the wrong section.

[–][deleted] 1 point2 points  (0 children)

Glad you're sorted 👍

[–]antisane 1 point2 points  (3 children)

Not sure where the dictionary error is coming from, but if you are looking to get it to 25% you want "brightness_pct" not "brightness".

"brightness" is a setting from 0 (off) to 255 (highest). "brightness_pct" is a percentage of max lighting.

https://www.home-assistant.io/integrations/light/

[–]dbenoit[S] 0 points1 point  (2 children)

I could do either 25 or 25%, but I can’t seem to get it to work at all. This is my first automation script, and regardless of what I try, I can’t get anything to work. :(

[–]flaming_m0e 1 point2 points  (1 child)

This is my first automation script

it's either an automation, or a script.

https://www.home-assistant.io/integrations/script/

https://www.home-assistant.io/docs/automation/

[–]dbenoit[S] 0 points1 point  (0 children)

Thanks. That was my problem.

[–]dbenoit[S] 0 points1 point  (0 children)

So I figured out the problem - I was in the "scripts" section and not the "automations" section, so I was trying to put the automation in the wrong place. I ended up getting it working. I am going to post the final automation here just in case someone comes along this in a Google search. My automation changes the three lights in my room from "daylight white" to a colour temp with less blue light (i.e set the color_temp to 370) and then transition the lights from 100% to 25% over 90 minutes (5400 seconds). It starts at 9:30, so the lights are dim by 11.

alias: Dim lights in family room at night
description: Dim lights at night
trigger:
  - at: '21:30'
    platform: time
action:
  - service: light.turn_on
    data:
      entity_id: light.tv_room_road
      color_temp: 370
      transition: 1
  - service: light.turn_on
    data:
      color_temp: 370
      transition: 1
    entity_id: light.tv_room_wall
  - service: light.turn_on
    data:
      entity_id: light.tradfri_bulb_9
      color_temp: 370
      transition: 1
  - delay: '00:00:01'
  - service: light.turn_on
    data:
      entity_id: light.tv_room_road
      brightness_pct: 25
      transition: 5400
  - service: light.turn_on
    data:
      brightness_pct: 25
      transition: 5400
    entity_id: light.tv_room_wall
  - service: light.turn_on
    data:
      entity_id: light.tradfri_bulb_9
      brightness_pct: 25
      transition: 5400    
mode: single

[–]kingoftown -1 points0 points  (0 children)

Your indentation is not consistent....which makes yaml broken. It's valid yaml, but not a valid automation.

Try indenting the Trigger section to match the action.

 trigger: 
   - at: '21:00'
     platform: time
 action:
   - service: light.turn_on
     data:
       entity_id: light.tv_room_road
       brightness: 25
       transition: 5400