Automation conditions using value template based on event trigger entity_id

I have a value template condition within the alarm system automation which was previously working fine. I recently noticed the following error in the log file:

Error in 'choose[2]' evaluation: In 'or' (item 2 of 2): In 'template' condition: UndefinedError: 'dict object' has no attribute 'event'

I have traced the error back to the following value template condition:

condition: or
conditions:
  - condition: template
    value_template: >-
      {{ trigger.entity_id != 'binary_sensor.alarm_zone_01_pir_first_floor_hall'
      }}
  - condition: template
    value_template: >-
      {{ trigger.event.data.entity_id !=
      'image_processing.deepstack_object_ip_camera_north' }}

It would appear the second condition based on the event trigger is causing the issue. I have tested the automation and can confirm this condition is no longer working. The automation processes even when the camera entity triggers the automation.

Can anyone see what the problem could be? Any suggestions gratefully received.

One option:

conditions:
  - condition: template
    value_template: >
      {% if trigger.platform == 'event' %}
        {{ trigger.event.data.entity_id !=
        'image_processing.deepstack_object_ip_camera_north' }}
      {% else %}
        {{ trigger.entity_id != 'binary_sensor.alarm_zone_01_pir_first_floor_hall' }}
      {% endif %}

Nice. Works perfectly, many thanks for your help.

Could anyone tell me why the following template condition isn’t working as expected please. It will work if the triggering platform is event however if the triggering platform is state nothing happens. I want the automation to run on any event triggers apart from camera_north and on any state triggers.

{% if trigger.platform == 'event' %}
  {{ trigger.event.data.entity_id !=
  'image_processing.deepstack_object_ip_camera_north' }}
  {% elif trigger.platform == 'state' %}
{% endif %}

Your elif doesn’t return anything… there are any number of ways to fix it, for example:

{% if trigger.platform == 'event' %}
  {{ trigger.event.data.entity_id != 'image_processing.deepstack_object_ip_camera_north' }}
{% else %}
  true
{% endif %}

or

{% if trigger.platform == 'event' %}
  {{ trigger.event.data.entity_id != 'image_processing.deepstack_object_ip_camera_north' }}
{% else %}
  {{ trigger.platform == 'state' }}
{% endif %}

Thank you - working perfectly.