Trigger automation when temperature goes down (from unknown value, to unknown value)

I have a kind of heater to my pool which only does any good when the sun is shining.
So I want to turn the pump off when thats no longer the case.

I can not use sun up/down, I also have to consider the weather (cloudy, rainy or sunny) as well as trees blocking the heater at certain times during the day.

So my thought was that when the temperature from the inlet starts to sink (a sign that the heater is not doing any good) I should turn the pump off. So how do I trigger an automation based on dropping temperature (for example during the last 15 minutes the temperature has dropped 0.5 degrees).

How often do you get new values?

Every second, but I can choose if it matters. (Esphome with sensor)

You could use a trend binary sensor.

Awesome, exactly what I needed! You gotta love HA :wink:

Hi

How did you manage doing it?