For used with below trigger in automation

I would like to use a for statement to prevent bouncing on an automation based on power readings.

IE when the power goes below a specific value for a few seconds.

  - alias: Washer cycle complete
    trigger:
      platform: numeric_state
      entity_id: switch.washer
      value_template: '{{ state.attributes.current_power_w | int }}'
      below: 7
      for:
        seconds: 30

The below trigger alone works most of the time but I sometimes get extra triggers as the washer reaches the end of the cycle and bounces below 7. Adding the for value however does not validate.

Is this supposed to work or is there another way I could do this?

Unfortunately for isn’t supported with numeric_state (I’ve a few automations it would be useful in too).

I’d probably suggest a template binary sensor, to set it off when the value is below 7. Something like:

binary_sensor:
  - platform: template
    sensors:
      washing_machine:
        value_template: '{{ states.attributes.current_power_w | int > 6}}'
        friendly_name: 'Washing machine state'

That should then be usable in your automation, and support the for option.