Template sensor state change after x duration

Hi there,
unfortunately i couldnt find a solution in the forum.

So i got a template sensor for my Dryer which is

 - name: Trockner
    unique_id: '0a7476cc-d6c1-40ba-8ae1-601218c34971'
    state: >-
      {% if states ("sensor.trockner_power")|float(0) <= 0.5 %}
        Off
      {%elif states ("sensor.trockner_power")|float(0) <=1.9 %}
        Standby
      {% else %}
        Drying 
      {% endif %} 

Unfortunately the power consumption dips to 0 Watts for a brief period (<10sec) while running, so this sensor displays “Off” for a short time.

Is there a possibility for the state change to offline only happening when the power consumption is <0.5 for say 10s.
Unfortunately delay_off is only available for binary_sensors

cheers

You could create a binary sensor with delay_off and then build the sensor you have on top of that. I’m sure there’s a better way though.