Filter out high / low temperature values

My temp sensor are recording sometimes strang high and low values.
Is there a option to filter out the strange values.
Mayby with a template sensor?

This was not answered back then. I’m still interested though.
I have a luftdaten DHT22 sensor that occasionally goes up to a few million degrees celsius.

What I would like to achieve with a template sensor is the following:

if new_temp < 60
use new temp value
keep old value (i.e. do not update)

Probably don’t even need the else clause. I’m no jinja master, if anyone could give an example, that’d be great :slight_smile:

Apparently I need to Google before asking, the filter sensor should do the trick!