Automation triggering automation canceling other automation - simplify help

So for a ‘wake up light’ emulation, i have different automations, triggering other automations and canceling other automations.

I know I could probably turn this into one large automation (i’m not so good with code) and if/else,
but is it a problem having different automations triggering and canceling each other?
I’m a bit affraid that If I put this in one big automation, I will lose the overview and it will be more difficult to change a value (I think)

what happens is:

  1. When I set the alarm on my phone (pixel 3xl) the sensor…next_alarm shows my next alarm time (in unreadable format but ok)
  2. I have an automation that translate that (unreadable) value to a clear timestamp value date + time
  3. that timestamp is written to a helper but with minus 15 minutes
  4. if during this proces I cancel my alarm, the Next_alarm sensor will automaticly get value “unavailable”
    1. If the alarm stays on (and the above status isn’t “unavailable”), a new automation will trigger my light to slowely go brighter during 15 min

for info you are interested: my automations.

My automations:

  1. is just a sensor : sensor.pixel_3_xl_volgende_alarm

  2. (translate to readable value)

alias: wekker juiste uur
description: ''
trigger:
  - platform: state
    entity_id: sensor.pixel_3_xl_volgende_alarm
condition: []
action:
  - service: input_datetime.set_datetime
    data:
      timestamp: '{{ as_timestamp(states.sensor.pixel_3_xl_volgende_alarm.state)  }}'
    entity_id: input_datetime.alarm_datum_en_uur
mode: single
  1. write timestamp minus 15 minutes to helper
alias: wekker zon
description: ''
trigger:
  - platform: state
    entity_id: sensor.pixel_3_xl_volgende_alarm
condition: []
action:
  - service: input_datetime.set_datetime
    data:
      timestamp: >-
        {{ as_timestamp(states.sensor.pixel_3_xl_volgende_alarm.state) - 60 * 15
        }}
    entity_id: input_datetime.voor_alarm
mode: single

4 + 5) if alarm is still set execute wake-up light:

alias: kwartier voor alarm
description: ''
trigger:
  - platform: time
    at: input_datetime.voor_alarm
condition:
  - condition: not
    conditions:
      - condition: state
        entity_id: sensor.pixel_3_xl_volgende_alarm
        state: unavailable
action:
  - service: automation.trigger
    data: {}
    entity_id: automation.wake_up_light_boven
mode: single

is it ok to work this way or could I make it a lot simpler?
Thanks guys !!

It’s not necessarily a problem, after all the services to turn on/off automations are there for a reason.

However my personal thoughts are that it’s an added layer of complexity that should be used as a last resort. A simple explanation of why being that if we consider a light needs turning on under a certain combination of circumstances I can craft one automation to do so, or I can craft one automation that has half the circumstances that turns on the light, and a second automation that monitors the other half of the circumstances and turns the first automation on and off accordingly.

If the second automation’s only purpose is to control the first, then it’s a waste of code and could potentially go ‘out of sync’. If the second automation also serves other purposes, then potentially I may want to modify it in the future, which may inadvertently affect the first.

Personally I think you having 5 automations here is massively overcomplicated. In fact, it’s not 5, it’s actually 6 because your automation 5’s action is to trigger a 6th automation.

Put simply, you could delete all 5 of those automations and just add a template trigger to the 6th automation that triggers it when the current time matches 15 minutes before your next alarm sensor.