Need help with temperature associated rule

I currently use this rule to start the fans at my rack when it goes over a certain temperature.

rule "Rackfan power to ON at 1200hr"
	Time cron "0 0 12 ? * Mon-Sun *" or
	Item PS3Powerstrip22URack_Temperature received update
	if ((PS3Powerstrip22URack_Temperature.state > 40) && now.getHourOfDay() >=13 && now.getHourOfDay() <=18) {
	sendTelegram("bot1", "Rackfan is switched ON as rack temperature is above 40°C" )
	logInfo("Info","Rackfan power ON Rule fired")	    
    else if ((PS3Powerstrip22URack_Temperature.state < 40) && now.getHourOfDay() >=13 && now.getHourOfDay() <=18) {
	logInfo("Info","Rackfan power OFF Rule fired")	

How do I change it that it only turns off at least 10 minutes after it detects the temperature falling below the threshold, and to fire the rule again only after at least 1 hour after it detects the temperature change (to stop spamming me with messages)

Create a timestamp when you turn it on. When the Rule fires check that timestamp to see if it has been enough time since the last command.

Hi Rick
Are you able to share how exactly do you create a timestamp on the rule? I am rather new at this.

Define a global variable. Let’s call it timestamp.

In the rule

timestamp = now

Here is a rule example which compares two times to make a simple decision similar to your use case. It might get you started. Ask more questions as your go and we’ll get this working!

Thanks so much Andrew. Will I will definately try to understand it