NFC tag with tag_id as trigger and device_id as condition for automation... help needed

I already have the following automation written and working, but this set of triggers and conditions does not care who scanned, on the state of devices. I would like to add another conditions section with this basic automation that would use the device_id of the device that was scanning to determine if it was my device and if it is my device then dismiss the next couple of alarms on my phone if the time is between 6:30am and 7:15am. The short side of the story is that I hate taking a shower at 7:05am and listening to my 7:15am or 7:25am alarm for 5 minutes each.

For the life of me, I cannot figure out how to use device_id as a condition rather than a trigger and other than reading on this site I have not started work on the alarm dismissal problem. It appears that I wrongly assumed that the tag scan would set a state that would contain the device_id until that tag was scanned again. I have 4 people who can and do scan this tag at random times during the day and do not want to mess with their android alarms at all. There is quite a bit more to this automation, but the first section is the key one I would use to dismiss alarms.

- id: nfc_bathroom_heat 
  alias: NFC bathroom heat
  mode: restart
  trace:
    stored_traces: 10
  trigger:
    - platform: tag
      tag_id: 5c75bdd6-20d2-4d08-a28b-a3944363782c
  action:
    - choose:
        - conditions:
            - condition: state
              entity_id: switch.bathroom_heater
              state: 'off'
          sequence:
            - service: switch.turn_on
              entity_id: switch.bathroom_heater
            - service: light.turn_on
              entity_id: light.bathroom_1,light.bathroom_2
              data:
                brightness_pct: 100
                transition: 120
            - service: timer.start
              entity_id: timer.bathroom_heat_tag
            - service: input_boolean.turn_on
              target:
                entity_id: input_boolean.notify_bathroom_tag
            - service: timer.cancel
              entity_id: timer.bathroom_motion_long
            - service: timer.cancel
              entity_id: timer.bathroom_motion_short
            - service: system_log.write
              data:
                message: NFC Tag Bathroom scanned to turn on heat

Thanks Matt

my test:

trigger:
  - platform: tag
    tag_id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
condition:
  - condition: template
    value_template: "{{trigger.event.data.device_id != 'a'}}"
action:
  - service: notify.persistent_notification
    data:
      message: "{{trigger.event.data.device_id}} % {{trigger.event.data.tag_id}}"

key point:
trigger.event.data.device_id

I am trying to use this to disarm an alarm and would like to use different key codes (and hopefully eventually presence) based on who scanned the tag.

To do this I am using “trigger.event.context.user_id”, but that value it appears is being overwritten. My trace reveals the following (redacted):

this:
  context:
    id: sssss
    parent_id: null
    user_id: null
trigger:
  event:
    context:
      id: AAAA
      parent_id: null
      user_id: myuserid
  description: Tag scanned

But when I click on the “options” step the changed values are:

context:
  id: xxxxxxxx
  parent_id: AAAA
  user_id: null

I have tried to define variables, but any time I try defining HA is seeing this as an action and then my user_id is gone and it outputs a null response.

Is it possible to use reference trigger variables such as device_id or user_id in choose in actions?

It seems like a nice addition to define custom global (within the automation) variables like user_id or device_id, similar to the “this” variable, so they could be referenced at any point in the automation would be a nice addition.

Thanks to a lot of help I was able to implement a solution.

https://community.home-assistant.io/t/wth-there-is-no-triggered-by-user-condition-is-automations/467352/13?u=bk111