Stop automation from triggering when value is "flickering"

I have an automation triggering a python script when the temperature changes of a thermometer.

  - alias: 'Run tempscript on temp change'
    trigger:
      platform: state
      entity_id: sensor.temp
    action:
      service: python_script.tempscript

It works, however sometimes the temp-value is right in between two integers and the value changes rapidly between two numbers for a minute or two: 6, 7, 6, 7, 6, 7. I’d like my script to only be run when the value has been steady for a while.

I tried applying the for x minutes, however that expects a to value, which I don’t have? Can I do it in some other way?

1 Like

Maybe a

with a low sampling_size value.

Or a

triggered by values between 6 & 7.

1 Like

This could also help.

1 Like

Thanks a lot! Both will work for me!

1 Like