Automation condition keeps failing

Please see the trigger below. I want the automation to fire when anyone’s presence changes from anything to anything. The trigger seems to fire correctly but the condition fails. Did I write this wrong?

  alias: Presence notification
    description: ''
    trigger:
    - platform: state
      entity_id: device_tracker.life360_buster
    - platform: state
      entity_id: device_tracker.life360_trixie
    condition:
    - condition: template
      value_template: '{{ trigger.to_state.state != trigger.from_state.state }}'
    action:

A State Trigger will trigger when the entity’s state value changes or the value of any of its attributes changes.

From the first line of the State Trigger’s documentation:

Fires when the state of any of given entities changes. If only entity_id is given, the trigger will fire for all state changes, even if only state attributes change.

Your condition is designed to reject the case where the entity’s state did not change. However, that’s a situation that would never cause the State Trigger to trigger anyway because a state-change is needed to trigger it. What your condition effectively does is confirm the trigger occurred because the value of one of the device_tracker’s attributes changed.

Is that what you want your condition to do?

What I intended was to allow it to trigger if any attribute changed, but stop with the condition if it wasn’t the state that changed. It does look to me like I was overthinking it, but I don’t want the automation to run with any attribute change. As I said, my goal is to trigger the automation whenever anyone’s presence changes to or from any location’s name. Would the following do this without triggering on any attribute change?

  alias: Presence notification
    description: ''
    trigger:
    - platform: state
      entity_id: device_tracker.life360_buster
      to:
    - platform: state
      entity_id: device_tracker.life360_trixie
      to:
    condition: [ ]
    action:

It’s confusing because on the 2021.12 blog, they say that it make it react to ONLY state changes, you can leave the to: or from: empty, BUT in the example code they are using a tilde:

to: ~

So it’s not clear if you are supposed to leave it empty, or use a tilde.

OK then do what you suggested and add an empty to: to the triggers (this is new functionality, just introduced in version 2021.12.0). If you wish, you can write it like this:

  alias: Presence notification
    description: ''
    trigger:
    - platform: state
      entity_id:
      - device_tracker.life360_buster
      - device_tracker.life360_trixie
      to:
    condition: [ ]
    action:

Awesome! thanks for the help. I’ve just spend a couple of hours wrestling with the actions, a message that writes to a file and a text from Telegram. The whole thing looks like this:

- id: '1653236234520'
  alias: Presence notification
  description: ''
  trigger:
  - platform: state
    entity_id: 
    - device_tracker.life360_buster
    - device_tracker.life360_trixie
    to:
  condition: [ ]
  action:
  - service: notify.presence_file
    data:
      message: '{{now().strftime("%a %m/%d/%Y @ %H:%M")}} {{ trigger.to_state.name}} {{''left'' if trigger.to_state.state == ''not_home'' else ''arrived at''}} {{trigger.from_state.state if trigger.to_state.state == ''not_home'' else trigger.to_state.state}}'
  - service: notify.presence_telegram
    data:
      message: '{{ trigger.to_state.name}} {{''left'' if trigger.to_state.state == ''not_home'' else ''arrived at''}} {{trigger.from_state.state if trigger.to_state.state == ''not_home'' else trigger.to_state.state}}'
  mode: single

It seems to work great, with the timestamped text file looks like this:

Fri 12/17/2021 @ 20:14 trixie left home
Fri 12/17/2021 @ 20:33 trixie arrived at the bar