Condition based energy sensor increase

Hi, i would like to create an energy sensor (sensor.ebat_out) that increase when another energy sensor change (sensor.e_ut) but only under certain condition (sensor.vinv > 10). I’m trying this but i’m not sure that it is working… Can someone check if it is correct?

template:
  - trigger:
      - platform: state
        entity_id:
          - sensor.e_ut
    sensor:
      - name: EBAT OUT
        unique_id: ebat_out
        state: >
          {% if (states('sensor.vinv') | int (default=0)  ) > 10|int (default=0) %}
            {{ states('sensor.ebat_out') | int (default=0) +1 }}
          {% endif %}
        unit_of_measurement: "kWh"
        device_class: energy
        state_class: total_increasing

Just tested. It seems to work.