Turn on ceiling fan

I have a temperature sensor ar floor height and one at ceiling height. I want to use the difference in temperature to turn on a ceiling fan rather than an absolute temperature ie fan turns on when ceiling temp is 5° above floor temp. Is that possible in Node Red?

It is definitely possible to calculate differences.

It is definitely possible to turn on a fan.

It all depends on what equipment you have and how is connected.

I use Node Red from Home Assistant. I have two temp sensors that use DHT22 and Wemos D1 mini. I intend for the fan to be turned on and off with a Sonoff wifi switch. Thanks.

the way I would do it is have the WeMos's read the DHT22's and send the data to NR via MQTT. (That would be easy to setup using ESPEasy on the WeMos's)

In NR I hafe a flow taking the readings and sticking them into a flow or global vaiables.

I'd have another flow (a watchdog) run at some interval of time (your choice) using an inject node to trigger it . It would read the two variables and compare them. It the ceiling variable is 5 degrees above the floor, send 'on' to the Sonoff switch.

If the floor was equal to or more than the ceiling temp, send an 'off' to the Sonoff.

You could add in code holding the Sonoff's state so if the ceiling was 5 degrees aabove the floor AND the sonoff was already on, don't bother to send anything.