Trigger Id in templates

I have an automation that should be triggered whenever either one of two entities changes value. By default the state change will fire whenever any attribute changes. My usual work around is to create a condfition:

condition:
    - condition: template
      value_template: "{{ trigger.to_state.state != trigger.from_state.state }}"

the problem here is that I have 2 triggers, so how would you reference them in the condition template?

Something similar to this:

alias: Ben Weight
description: ''
trigger:
  - platform: state
    entity_id: sensor.ble_weight
    id: trigger1
  - platform: state
    entity_id: sensor.ble_impedance
    id: trigger2
condition:
  - condition: or
    conditions:
      - condition: template
        value_template: '"{{ trigger1.to_state.state != trigger1.from_state.state }}"'
      - condition: template
        value_template: '"{{ trigger2.to_state.state != trigger2.from_state.state }}"'
action:
   .......

of course here it gives me the error :
Error: In ‘template’ condition: UndefinedError: ‘trigger1’ is undefined

is there a proper way of doing this?

There is only one trigger variable and it contains information about whichever one of the two triggers have triggered the automation.

When you do this:

    id: trigger1

you aren’t defining a new trigger variable (or any kind of variable); you are simply assigning a value to one of the trigger variable’s properties (id). That’s why this error message was generated:

Error: In ‘template’ condition: UndefinedError: ‘trigger1’ is undefined

If you want to reject triggers where the entity’s state value remains unchanged (meaning it was triggered by an attribute changing value), then simply do this:

alias: Ben Weight
description: ''
trigger:
  - platform: state
    entity_id: 
      - sensor.ble_weight
      - sensor.ble_impedance
condition: "{{ trigger.to_state.state != trigger.from_state.state }}"
action:
   .......

Love simple solutions, thanks

Hello,
Is there a way to set trigger-id?
The code below doesn’t work.

{% if('sensor.sunrise_time') > ('06:15:00') %}
{{states.state.trigger_id,('on')}}
{%else%} 
{{states.state.trigger_id,('off')}}
{%endif%}

No.

The trigger variable is created when the automation is triggered. It’s an object with several properties, including an optional one called id. For more information, refer to Trigger ID.

Oké thanks,

is it possible to use

condition: template
value_template: '{{ states('sensor.sunrise_time') > ('06:15:00') }}'

I want to use it as follows

id: '1643033363940'
alias: Test sjabloone
description: ''
trigger:
  - platform: state
    entity_id: input_boolean.sjabloontest
    from: 'off'
    to: 'on'
condition:
  - condition: template
    value_template: '{{ states(''sensor.sunrise_time'') > (''06:15:00'') }}'
action:
  - service: switch.turn_on
    target:
      entity_id: switch.shelly1_e8db84acb63b
mode: single

Seems to work now.
Had to restart Home Assistant.