Compare values in automation

Can I compare the values of two sensors in automation?
This code does not work:

automation:
  - alias: Accendi
    trigger:
      platform: numeric_state
      entity_id: sensor.temperatura_interno
      above: sensor.temperatura_esterno
    action:
      service: switch.turn_on
      entity_id: switch.presa

and this is the same

automation:
  - alias: Accendi
    trigger:
      platform: numeric_state
      entity_id: sensor.temperatura_interno
      above: {{ states.sensor.temperatura_esterno }}
    action:
      service: switch.turn_on
      entity_id: switch.presa

Use the template automation platform