Grafana Alerting on temperature change

Grafana 8.3.4 with Influx 1.8

I need a little help figuring out the alerting function in Grafana. I want to alert on a temperature deviation.

What I want to detect is if the temperature rises more than 5 degrees over average. My data points are every 5 mins. If the current temp is 5 degrees more than the last say 2 samples, generate an alert. This has to be easy but I apparently can’t figure it out. I’m thinking I need to somehow be looking into the past at time.

Sample temperature graph. You can see it picked up the change and went ‘pending’ but never alerted and went OK.

What I’ve tried.

As it so happens, I figured it out as soon as I posted. Here is how I made it work. Will mark as solved and leave the post in case someone else needs it.