Automation, triggers but condition fails

Hi, trying to get HA to do something different based upon who pushes a button in the UI
made a button helper input_button.naar_bed and had a condition, that now should trigger if anyone BUT the sys presses the button. But it fails…

id: '1666207961471'
alias: Naar Bed
description: Per gebruiker
trigger:
  - id: button
    platform: state
    entity_id: input_button.naar_bed
condition:
  - condition: template
    value_template: |
      {{ trigger.event.data.new_state.state.context.user_id != 'null' }} 
action:
  - service: light.toggle
    data: {}
    target:
      entity_id: light.primelamp
mode: single

I have never seen a | like that.
Are you sure you aren’t confusing it with > ?

condition:
  - condition: template
    value_template: >
      {{ trigger.event.data.new_state.state.context.user_id != 'null' }} 

Or just:

condition:
  - condition: template
    value_template: "{{ trigger.event.data.new_state.state.context.user_id != 'null' }}"

@Hellis81 the vertical bar is a valid YAML multiline character. See YAML Multiline Strings (yaml-multiline.info).

@Sandmman a state trigger does not generate trigger.event. See Automation Trigger Variables - Home Assistant for the value of the trigger variable after a state trigger fires. Also note that in YAML null is a valid value (which is equivalent to Python’s None), which is different from ‘null’ (which is a string.)