Recognising device based on iOS action fired

Hello all , i’m trying to enhance a HA automation logic that opens my main gate gate when it runs via Apple shortcut automation (phone connects to car bluetooth)

In my HA automation, I’m checking if a specific device is at home, then open the main gate. Else, prompt that I am not within home hence gate won’t open.

I’m trying to achieve a if condition that dynamically checks if the device that triggered the HA action is at home.

This is my current automation

> alias: iOS exit home gate open
description: >-
  Used in apple shortcut automation to open gate once phone connected to
  bluetooth
trigger:
  - event_type: ios.action_fired
    platform: event
    event_data:
      actionName: iOS exit home
condition: []
action:
  - if:
      - condition: device
        device_id: 65041e67c026b23b9a3998
        domain: device_tracker
        entity_id: 08fea726fc7417f6109
        type: is_home
    then:
      - service: automation.trigger
        metadata: {}
        data:
          skip_condition: true
        target:
          entity_id: automation.main_gate_open
      - device_id: 65041e67c026b23b9a3998
        domain: mobile_app
        type: notify
        message: Leaving Home, Gate is opening
        title: "Exit Home, iOS open gate. "
    else:
      - device_id: 65041e67c026b23b9a3998
        domain: mobile_app
        type: notify
        message: Gate will not open because you are not home
        title: You’re not home. Gate will not open
mode: single