stevland
(Stevland Ambrose)
May 25, 2023, 4:46pm
1
I have a group named All Interior Lights .
I also have an automation that brightens the group by 1% every 12 seconds, until full brightness is reached after 20 minutes.
action:
- delay:
seconds: 12
- service: light.turn_on
data:
brightness_step_pct: 1
target:
entity_id:
- light.all_interior_lights
- delay:
seconds: 12
- service: light.turn_on
data:
brightness_step_pct: 1
target:
entity_id: light.all_interior_lights
- delay:
seconds: 12
- service: light.turn_on
---etc---
But how can I set it up so that…
a) any lights that are already off when the automation starts are ignored?
b) any lights that are subsequently turned off are also ignored?
Both conditions would be wonderful but if b) is too complicated I’ll gladly settle for a).
stevland
(Stevland Ambrose)
May 25, 2023, 8:46pm
2
I figured out how to set this up with a repeating sequence, which is far more elegant.
alias: Brightness fade in
description: ""
trigger:
- platform: time
at: "06:00:00"
condition: []
action:
- service: light.turn_on
data:
brightness_pct: 1
target:
entity_id: light.all_interior_lights
- repeat:
until:
- condition: numeric_state
entity_id: light.livingroom_overhead_01
attribute: brightness
above: 254
sequence:
- service: light.turn_on
data:
brightness_step_pct: 1
target:
entity_id: light.all_interior_lights
- delay:
hours: 0
minutes: 0
seconds: 12
milliseconds: 0
mode: single
But my a) and b) questions remain.
I’ve tried searching the forum for insight. I must be missing something because I would have assumed these would be very common questions.
You could use an ad hoc “Old Style” group for “b”… “a” would require that any light you want affected by the automation is always on a little bit, which would be tedious to maintain.
stevland
(Stevland Ambrose)
May 25, 2023, 11:22pm
4
Would you please explain what you mean by ad hoc “Old Style” ?
ad hoc Old-style explanation
You can use the service group.set
to set the members of an “Old-Style” groups . Any changes made using the group.set
service are not permanent. They will not survive restart or reloading the Group integration, but they are useful for temporary/situational use.
Now that I think about it, you should be able to do it without one…
alias: Brightness fade in
description: ""
trigger:
- platform: time
at: "06:00:00"
condition: []
action:
- service: light.turn_on
data:
brightness_pct: 1
target:
entity_id: light.all_interior_lights
- repeat:
until:
- condition: numeric_state
entity_id: light.livingroom_overhead_01
attribute: brightness
above: 254
sequence:
- variables:
lights_list: |-
{{ state_attr('light.all_interior_lights', 'entity_id')
| select('has_value') | reject('is_state', 'off') | list }}
- service: light.turn_on
data:
brightness_step_pct: 1
target:
entity_id: '{{ lights_list }}'
- delay:
hours: 0
minutes: 0
seconds: 12
milliseconds: 0
mode: single
stevland
(Stevland Ambrose)
June 1, 2023, 10:50pm
6
Yikes! I don’t recall seeing a notification for this reply. Luckily I left the tab open and just found it while doing a little housekeeping.
Thank you for writing this. I’ll give it a try soon and let you know how it works out.