Control an electric heater

An electric heater should be switched on for 1 hour via the dashboard and switched off via a countdown, for example.
In addition, the temperature should be controlled via a ds18b20 and MQTT (Home/TempAZUT).
Only switch on between 7 a.m. and 7 p.m., even if the temperature is lower than 23° and not higher than 25°.
I can regulate the running time via a countdown. The running time and temperature control also work.

But I don't know how to bring the countdown time into play and would appreciate a tip.
Greetings
Thomas
electric-heater.json (10.2 KB)

I can't help with the countdown timer, but as a word of caution, the DS18B20 can fail unexpectedly, so I'd suggest using a few of them to set an average that ignores missing entries. I love the sensors and use them all over the place, but I have had several stop responding in different places from different purchase batches.

How do you switch the power?
I use a smart socket flashed with Tasmota.

There is a Tasmota setting PulseTime which makes the relay turn off automatically after a specified period.
Node-red sends "ON" via MQTT.
The relay turns on and it will turn off after the specified delay even if the network goes down, but you can also send "OFF".

It's perfect for my vintage coffee machine which can't tolerate being accidentally left turned on, but that's only 1kW.
My sockets claim to be able to switch 13A but I have not tested that.

I do have a countdown widget on the NR dashboard, it just retrieves the time remaining from Tasmota every 5 sec.

Thanks for your ideas. This electric heater is under a desk by the window and must therefore not get too hot, so it has to be regulated. The temperature sensor and the radio-controlled socket were present. Therefore I would like to turn on the heating for 1 hour, Temperature controlled. In principle, the heating should not be able to be switched on at night. The way I've been doing it so far will regulate the temperature, but not turn it off. Again the question: Is there an idea to carry out regulations and time limits together.
Thank you Thomas

If you want to block the On messages during certain periods then you could use node-red-contrb-simple-gate driven from node-red-contrib-cron-plus or another time scheduler. You could also use the cron node to explicitly turn the heater off at certain times if that is required.

A flow to combine temperature based control with Colin's suggestion of a gate, all within Node-red, might look something like this.

Should the gate be before the RBE? Otherwise it will not turn on when the gate opens. In fact I think maybe the top RBE should not be there.

I think I was assuming that temperature readings would be like tube trains. If you miss one there will be another along in a couple of minutes.

There's definitely something wrong with the RBEs though since only ON ever gets to the top and only OFF to the bottom one.
They should be deleted, but the trigger probably needs be protected from repeated ONs.
A Delay node set to rate limit, 1 msg/hr and discard intermediate messages should work.

So the back of a fresh envelope looks like this

I don't think you need the rate limit node. Instead don't set Extend Delay in the trigger node.

It might also need a link from the cron node to the heater to switch it off when the blocked time starts.