Assembling three (or four) automations into one?

After tinkering a room light sequence to the point it’s perfect, I ended up with 4 automations. Three of them turn on the light, and the last one turns them off.

The tricky thing for me here is that the three first automations have different ‘or’ conditions stacked on the ‘and’ conditions. I have a hard time combining these different ‘or’ conditions to simply create one automation that sets the right lights on/off. I also don’t know if it is even possible, but why not ask: Most of my automations suffer this kind of ‘problem’, with some help I could learn a thing or two.

First three automations to set the right lights

- alias: Logeerkamer_Occupancy_Lights_on_While_music_plays
  description: 'Logeerkamer verlichting op basis van occupancy and slaapkamermuziek'
  mode: restart
  max_exceeded: silent
  trigger:
    - entity_id: binary_sensor.logeerkamer_pir_occupancy
      platform: state
      to: 'on'
  condition:
    - condition: state
      entity_id: input_boolean.alarm_triggered      # ON state means alarm clock was playing recently
      state: 'on'
  action:
    service: light.turn_on
    entity_id: light.logeerkamerverlichting


- alias: Logeerkamer_Occupancy_Lights_day_on
  id: '00000002098246'
  description: 'Logeerkamerverlichting overdag op basis van motion en occupancy'
  mode: restart
  max_exceeded: silent
  trigger:
    - entity_id: binary_sensor.logeerkamer_pir_occupancy
      platform: state
      to: 'on'
  condition:
    - condition: state
      entity_id: light.shelly1_68a0b8
      state: 'off'
    - condition: state
      entity_id: input_boolean.first_time_to_bed     # ON state means no one has gone to bed that day yet
      state: 'on'
    - condition: or
      conditions:
      - condition: sun
        after: sunset
        after_offset: "-00:30:00"
      - condition: numeric_state
        entity_id:
          - sensor.average_pir_voordeur
        below: 1000                                  # Adjust for daylight correction front door. Lower value = lights go on later
      - condition: state
        entity_id: switch.gordijnen_logeerkamer
        state: 'off'
  action:
    - service: light.turn_on
      entity_id: light.logeerkamerverlichting


- alias: Logeerkamer_Occupancy_Lights_night_on
  id: '000000020982234546'
  description: 'Logeerkamerverlichting nacht op basis van motion, occupancy en first time to bed'
  mode: restart
  max_exceeded: silent
  trigger:
    - entity_id: binary_sensor.logeerkamer_pir_occupancy
      platform: state
      to: 'on'
  condition:
    - condition: state
      entity_id: light.shelly1_68a0b8
      state: 'off'
    - condition: or
      conditions:
      - condition: state
        entity_id: input_boolean.first_time_to_bed      # ON state means no one has gone to bed that day yet
        state: 'on'
      - condition: state
        entity_id: light.nachtlampje                    # ON state means the bedlights are on (someone is probably reading)
        state: 'on'
  action:
    - service: light.turn_on
      entity_id: light.logeerkamerverlichting



- alias: Logeerkamer small light on during night if someone is in bed
  id: 'Nachtlampje logeerkamer'
  description: 'Logeerkamerverlichting snachts op basis van motion en bed occupancy'
  mode: restart
  max_exceeded: silent
  trigger:
    - entity_id: binary_sensor.logeerkamer_pir_occupancy
      platform: state
      to: 'on'
  condition:
    - condition: state
      entity_id: light.shelly1_68a0b8
      state: 'off'
    - condition: or
      conditions:
      - condition: state
        entity_id: input_boolean.first_time_to_bed      # OFF state means someone is in bed
        state: 'off'
      - condition: state
        entity_id: light.nachtlampje                    # OFF state means the bedlights are off (no one is reading) 
        state: 'on'
  action:
    - service: light.turn_on
      entity_id: light.iris
      data:
        brightness: 50
        rgb_color:
          - 255
          - 205
          - 81

And to turn them off:

# Lichten uit na occupancy timer of lichten aan timer is afgelopen
- alias: timer_logeerkamer_done
  mode: single
  max_exceeded: silent
  trigger:
  - entity_id: binary_sensor.logeerkamer_pir_occupancy
    platform: state
    to: 'off'
    for: '00:20:00'
  - entity_id: light.iris
    platform: state
    to: 'on'
    for: '00:40:00'
  - entity_id: light.shelly1_68a0b8
    platform: state
    to: 'on'
    for: '00:40:00'
  condition:
      - condition: state
        entity_id: binary_sensor.logeerkamer_pir_occupancy
        state: 'off'
  action:
    - service: light.turn_off
      data:
        entity_id:
        - light.iris
    - service: light.turn_off
      data:
        entity_id:
        - light.shelly1_68a0b8

For this particular case, I don’t see an advantage to consolidate the four automations into one.