I design a flow chart using the temperature to control the heater on/off. The temperature coming from a DHT-22 sensor connecting to the internet through the MQTT protocol.

The Node-Red connect to the MQTT broker first, and then the temperature data will be formatted by a function node before logged into the mqtt.log file.