Problems with a sensor that I want to convert a numeric value to on and off

I explain, I have a pump that takes water from the well and the current sensor shows the liters per minute, I need to know when the pump is running so with a certain data on and off, I tried with this template below but it does not convert the given…

- platform: template
  sensors:
    stato_pompa:
      friendly_name: "pompa pozzo"
      value_template: >-
        {% if is_state('sensor.flusso' == '0.00') %}
          off
        {% else %}
          on
        {% endif %} 
- platform: template
  sensors:
    stato_pompa:
      friendly_name: "pompa pozzo"
      value_template: >-
        {{ 'off' if is_state('sensor.flusso', '0.00') else 'on' }}

You may want to verify the 0 in Developer Tools, it may be just ‘0’ instead of ‘0.00’.

OR

- platform: template
  sensors:
    stato_pompa:
      friendly_name: "pompa pozzo"
      value_template: >-
        {{ 'on' if states('sensor.flusso') | int > 0 else 'off' }}
1 Like

really really thank you, sometimes the solution is under your nose but we can’t see it, thanks again