Automations with multiple independent conditions + actions

I’m trying to set up an automation that when i arm my alarm, it checks all my window sensors (mixture of device and binary sensors) and will then send a notification to my phone to say X window is open.

This is fairly straightforward for a single sensor, but i’m having some problems trying to incorporate multiple sensors with a condition and action. They have to be independent though as some windows may be closed and others open.

For action type i’ve tried “repeat”:

repeat:
  count: '1'
  sequence:
    - choose:
        - conditions:
            - type: is_open
              condition: device
              device_id: 20963e11fa1ce93c59e42a7e8d0f13e1
              entity_id: binary_sensor.openclose_24
              domain: binary_sensor
          sequence:
            - service: notify.mobile_app_g8341
              data:
                message: Bedroom window open
        - conditions:
            - condition: state
              entity_id: binary_sensor.office_window
              state: 'on'
          sequence:
            - service: notify.mobile_app_g8341
              data:
                message: Bathroom window open
      default: []

But this only runs through the first condition.

I’ve also tried action type “choose” with multiple options:

choose:
  - conditions:
      - type: is_open
        condition: device
        device_id: 20963e11fa1ce93c59e42a7e8d0f13e1
        entity_id: binary_sensor.openclose_24
        domain: binary_sensor
    sequence:
      - service: notify.mobile_app_g8341
        data:
          message: Bathroom window open
  - conditions:
      - condition: state
        entity_id: binary_sensor.office_window
        state: 'on'
    sequence:
      - service: notify.mobile_app_g8341
        data:
          message: Bedroom window open
default: []

But that always picks the first option, it may go on to the second option if the first condition is false i haven’t tested that.

Any ideas? Is the automation i’m trying to create even possible? or should i stick to individual automations for each window sensor?

TIA.

You can make a group of your window/door entity and uses expand() as well as selectattr() function to only select the ones that are open.

Take a look at this-

action:
  - service: notify.mobile_app_your_phone
    data:
      message: >
        {% set x = expand('binary_sensor.openclose_24', 'binary_sensor.office_window') | selectattr('state', 'eq', 'on') | map(attribute='name') | list %}
        Alert! The following {{'are' if x | count > 1 else 'is'}} open: {{ w | join(', ') }}