Phone notification: undefinederror: 'trigger' is undefined

My notifications to my phone don’t work anymore. They were working fine for months. When running them manually in the automattion I see this error:

error rendering data template: undefinederror: ‘trigger’ is undefined

What could be the problem? None of the entities changed.

alias: Smoke
description: ""
triggers:
  - entity_id:
      - binary_sensor.0x00158d0003d49d60_smoke
      - binary_sensor.0x00158d00039d8c52_smoke
      - binary_sensor.0x00158d00039d90ec_smoke
      - binary_sensor.0x00158d00045cd343_smoke
    from: "off"
    to: "on"
    enabled: true
    trigger: state
  - entity_id:
      - binary_sensor.0x00158d0003d49d60_smoke
      - binary_sensor.0x00158d00039d8c52_smoke
      - binary_sensor.0x00158d00039d90ec_smoke
      - binary_sensor.0x00158d00045cd343_smoke
    from: unavailable
    to: "on"
    enabled: true
    trigger: state
  - entity_id:
      - binary_sensor.0x00158d0003d49d60_smoke
      - binary_sensor.0x00158d00039d8c52_smoke
      - binary_sensor.0x00158d00039d90ec_smoke
      - binary_sensor.0x00158d00045cd343_smoke
    to: "on"
    enabled: true
    from: unknown
    trigger: state
conditions: []
actions:
  - data:
      title: Feueralarm
      message: "Ort: {{ trigger.to_state.name }}"
      data:
        ttl: 0
        priority: high
        channel: alarm_stream
        persistent: true
        tag: persistent
    action: notify.mobile_app_pixel_7

When you run an automation manually the triggers and conditions are skipped and only the actions are run. Thus the trigger variable you used will be undefined:

message: "Ort: {{ trigger.to_state.name }}"

To test this properly Go to Developer Tools → States and change the state of one of your entities there.

e.g. change binary_sensor.0x00158d0003d49d60_smoke to"on".

1 Like

That is exactly the problem and I think when I created the automation I knew that but forgot it now. Sorry for being and idiot and thank you!