Help with combining two conditional automations

I have the following two automations, which are working fine, but I’d like to merge them as I’d like to make them into a blueprint.

alias: Turn off kitchen light on no motion
description: ""
triggers:
  - entity_id: binary_sensor.kitchen_sensor_occupancy
    from: "on"
    to: "off"
    for:
      seconds: 5
    trigger: state
conditions:
  - condition: state
    entity_id: light.kitchen_light
    state: "on"
actions:
  - target:
      entity_id: light.kitchen_light
    data:
      brightness: "{{ (state_attr('light.kitchen_light', 'brightness')|float) / 2 }}"
      transition: 3
    action: light.turn_on
  - wait_template: "{{ is_state('binary_sensor.kitchen_sensor_occupancy', 'on') }}"
    timeout:
      seconds: 15
  - if:
      - condition: template
        value_template: "{{ wait.completed }}"
    then:
      - target:
          entity_id: light.kitchen_light
        data:
          brightness: "{{ (state_attr('light.kitchen_light', 'brightness')|float) * 2 }}"
          transition: 3
        action: light.turn_on
    else:
      - target:
          entity_id: light.kitchen_light
        action: light.turn_off
mode: single
alias: Turn on kitchen light on motion
description: ""
mode: single
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.kitchen_sensor_occupancy
    from: "off"
    to: "on"
condition:
  - condition: state
    entity_id: light.kitchen_light
    state: 'off'
action:
  - service: light.turn_on
    target:
      entity_id: light.kitchen_light

I’ve seen a couple of examples of merging automations but none with this particular use case of conditions mixed with if-then-elses. Any help or pointers is appreciated.

Hi, welcome to the forum!

You can combine them by assigning a trigger_ID (the 3 dots at the trigger line) to each trigger and in the action use a conditional action that runs if that ID has been triggered.

Hi Nick, thanks for the suggestion. But what about the other conditions?

They become part of the choose options in the automation’s actions section.

1 Like

Got it, thanks for your help both!

1 Like

Good it got solved!
If you’re willing to post the solution your thread becomes even more valuable for future searches.