Help needed to compare trigger.from_state and trigger.to_state for automation activations filtering

Hi. Im’ trying to get rid of frequent notifications from an automation that should only notify me when my public ip changes, but runs every time the public ip sensor is updated without any change.
Here the code of my automation:

alias: '[WAN] [01] - Nuovo IP Pubblico'
description: Avvisa al cambio di IP Pubblico
trigger:
  - platform: state
    entity_id:
      - sensor.ip_pubblico
condition:
  - condition: template
    value_template: '{{ trigger.from_state.state != trigger.to_state.state }}'
action:
  - service: notify.mobile_app_iphone_3
    data:
      message: '{{ states.sensor.ip_pubblico.state }}'
      title: Il Tuo IP Pubblico è cambiato in
mode: single

The error message I’m currently receiving is "template value should be a string for dictionary value @ data[‘value_template’]. Got None".
What am I doing wrong?
Thanks!!