I’ve managed to do what I wanted but is there a more elegant way of doing this?
This goes through the 5 different light scenes, showing each scene for 10 seconds. Then at 11pm, it shuts off the light.
Also, I want to replace the hard coded 11pm with a time input parameter that the user can set. Also, I want to replace the every 10 seconds to be a calculated value based on this:
(time input parameter - (sunset - 1hour)) / # of color scenes I have
(11pm - (7pm - 1hr)) / 5
5 hours / 5 = show 1 scene every 60 minutes
configuration.yaml
light: - platform: flux_led devices: 192.168.1.177: name: Kitchen_Ceiling_LED mode: "rgb" counter: sunset_color_num: initial: 0 step: 1
automations.yaml
- alias: LEDs on trigger: platform: time seconds: '/10' condition: - condition: time before: '23:00:00' action: - service: script.color_scenes - alias: LEDs off trigger: platform: time at: '23:00:00' action: - service: light.turn_off entity_id: - light.Kitchen_Ceiling_LED - service: counter.reset entity_id: counter.sunset_color_num
scenes.yaml
- name: color_1 entities: light.Kitchen_Ceiling_LED: state: 'on' color_name: 'red' brightness: 200 - name: color_2 entities: light.Kitchen_Ceiling_LED: state: 'on' color_name: 'yellow' brightness: 200 - name: color_3 entities: light.Kitchen_Ceiling_LED: state: 'on' color_name: 'blue' brightness: 200 - name: color_4 entities: light.Kitchen_Ceiling_LED: state: 'on' color_name: 'green' brightness: 200 - name: LED_off entities: group.LED_group: state: 'off'
scripts.yaml
color_scenes: sequence: - condition: state entity_id: sun.sun state: 'below_horizon' - service: counter.increment entity_id: counter.sunset_color_num - service: scene.turn_on data_template: entity_id: > scene.color_{{ states.counter.sunset_color_num.state }}