Insert delay into a sensor model

Hi everyone, I have this sensor, how can I insert a 50 second delay before it gives me off? Thanks

- sensor:
      - name: stati lavatrice
        state: >
          {% if states("sensor.lavatrice_active_power")|float == 0 %}
          off
          {% elif states("sensor.lavatrice_active_power")|float <= 6 %}
          pausa
          {% else %}
          on
          {% endif %}

Use a binary_sensor and its delay_off functionality

Thank you
my intention was a delay that after 10 seconds at 6 w switches to standby, in the model I can only use delay_off or delay_on.example

- sensor:
      - name: stati lavatrice
        state: >
          {% if states("sensor.lavatrice_active_power")|float == 0 %}
          off
          {% elif states("sensor.lavatrice_active_power")|float <= 6 %}
          standby
          {% else %}
          on
          {% endif %}

Make an input_select with your 3 values. Wrap it in a template sensor (optional, because you can just use the helper where ever you need it, but in case you want a read-only version). Make an automation with a state trigger for the “on” state with a for: requirement (i.e. it will trigger when the input helper has been in that state for the required time). In your action, call the service to set the helper to “standby”.