How set compare temperature differencefor ventilator?

I need to set the scene so that the fan will switch on when the ceiling temperature is 6°C higher than the floor. And then to switch off if the difference drops to 5°C or less, or if it is negative. How to create this?
Turning it on is easy, T1 ceiling, T2 floor, IF T1>T2 by 6° THEN fan ON.
But how to set the fan to turn off when the difference is reduced by 5°C? It looks easy, but try to set it somehow in the app, I can’t get it any way.

Thank you in advance for your help.

That’s an advanced automation I reckon, I would expect tools like Apple Shortcut/Node-Red/Home Assistant would do the trick