Hello to all,
As a beginner in HA, i have a currently many separate automations to control the light cycle on my aquarium. At this stage, i have a separate automation triggered based on time to turn the lights on or off in different times per day or to activate different scenes. I would like to replace all these automations with a single script that i wrote which i would like to validate with you. Before i paste the script, let me give you some information about the light set up of the aquarium.
The aquarium has 2 lights as follows:
-
Aquarium Main Light (this is the normal “bright” light) and it is controlled by a socket
-
Aquarium Night Light (this is a less bright RGB strip that is used to simulate different times of the day using scenes).
Explanation of the scenes:
-
Sunset (a yellowish colour scene at full brightness simulating the sunset)
-
Evening (an orange colour scene at 80% brightness simulating the golden hour)
-
Late Evening (a light blue colour scene at 50% brightness simulating just before dark conditions)
-
Midnight (a dark blue colour at 30% brightness simulating the night)
There are also some automations created using Assistant_Relay to fade in and out the night light. Here is the sequence of events i would like to happen:
- At 7:00 the Night Light starts to fade in (using Assistant_Relay automation)
- At 7:30 the Night Light activates the scene: Sunset (in this case it is used as sunrise)
- At 8:00 the Night Light turns off
- At 15:30 (in 7,5 hours from the previous event) the Night Light starts to fade in (using Assistan_Relay automation)
- At 16:00 the Main Light turns on
- At 16:01 the Night Light turns off
- At 21:59 The Night Light activates the scene: Sunset
- At 22:00 the Main Light turns off
- At 22:30 the Night Light activates the scene: Evening
- At 23:00 the Night Light activates the scene: Late Evening
- At 23:30 the Night Light activates the scene: Midnight
- At 23:31 the Night Light start to fade out (using Assistant_Relay automation)
Here is the script:
alias: Aquarium Light Sequence
sequence:
- service: automation.trigger
target:
entity_id: automation.aquarium_wake_up
- delay:
hours: 0
minutes: 30
seconds: 0
milliseconds: 0
- scene: scene.sunset
- delay:
hours: 0
minutes: 30
seconds: 0
milliseconds: 0
- service: light.turn_off
target:
entity_id: light.aquarium_night_light
- delay:
hours: 7
minutes: 30
seconds: 0
milliseconds: 0
- service: automation.trigger
target:
entity_id: automation.aquarium_wake_up
- delay:
hours: 0
minutes: 30
seconds: 0
milliseconds: 0
- type: turn_on
device_id: d9a64eb42220a161d1dd761ae689ac46
entity_id: switch.aquarium_main_light
domain: switch
- service: light.turn_off
target:
entity_id: light.aquarium_night_light
- delay:
hours: 5
minutes: 59
seconds: 0
milliseconds: 0
- scene: scene.sunset
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- type: turn_off
device_id: d9a64eb42220a161d1dd761ae689ac46
entity_id: switch.aquarium_main_light
domain: switch
- delay:
hours: 0
minutes: 30
seconds: 0
milliseconds: 0
- scene: scene.evening
- delay:
hours: 0
minutes: 30
seconds: 0
milliseconds: 0
- scene: scene.late_evening
- delay:
hours: 0
minutes: 30
seconds: 0
milliseconds: 0
- scene: scene.midnight
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- service: automation.trigger
target:
entity_id: automation.aquarium_sleep
mode: single
Could i kindly ask you to check the script and let me know if there is any error?
Thank you in advance
M