Binary_template value_template for 5 mins?

I have an automation which uses a tasmota POW device (Sonoff) to read Power Usage and determine if the Washing Machine is on or off:

binary_template.yaml:


  - platform: template
    sensors:
      washing_machine:
        friendly_name: "Washing Machine"
        value_template: "{{ states('sensor.tasmota_5087e5_2021_energy_power')|float > 2.0 }}"

Problem is, during a cycle, the washing machine will occasionally consume less than 2 watts and it switches binary_sensor.washing_machine to off (causing downstream automations to trigger).

How do I expand this to say, before it switches the binary_sensor to off, ensure the value_template is false for 5 minutes? (ie. the power usage has been 0w for 5 minutes)

Thanks

 - platform: template
    sensors:
      washing_machine:
        friendly_name: "Washing Machine"
        icon: mdi:washing-machine
        device_class: running
        value_template: "{{ states('sensor.tasmota_5087e5_2021_energy_power')|float(0) > 2.0 }}" 
        availability_template: "{{ states('sensor.tasmota_5087e5_2021_energy_power')|is_number }}" 
        delay_off: 
          minutes: 5

You should be using the new template sensor format though:

configuration.yaml

template:
  - sensor:
      - name: "Washing Machine"
        icon: mdi:washing-machine
        device_class: running
        state: "{{ states('sensor.tasmota_5087e5_2021_energy_power')|float(0) > 2.0 }}"
        availability: "{{ states('sensor.tasmota_5087e5_2021_energy_power')|is_number }}" 
        delay_off: 
          minutes: 5