Save if value has minimal change and maximum time

I’d like to save data every 30 seconds but always if value changes more than defined parameter.
Is it possible to set this conditions in telegraf?

Changes from what?

The last recorded value, no matter how long ago that was?

Or the value 30 seconds ago (even if that value wasn’t recorded because it was
the same as the one 30 second previously)?


Thanks for answer.
I measure temperature and would like to record every 30 seconds but also when temperature change more than 5 (defined parameter) from last record.
Where shouldn’t be a problem with how long ago is last record because last record should be max 30 seconds old.