I have a project underway to turn off my soldering iron after a set period using a Sonoff S26 smart outlet. I have flashed it with Tasmota and have the Sonoff posting MQTT messages about its status to NR.
I want to be able to turn on the outlet using the push button on the S26 but turn off after say 30 mins(I'm always leaving it on in my shed!). It doesn't have to be very accurate. I am looking for a node that can take the contents of a MQTT message payload, say POWER: "ON", and initiate a countdown and then initiate a power off message.
If you set the Tasmota PulseTime value, the relay will turn off after the specified time by itself.
For example, a socket in my kitchen has PulseTime1 = 1900 (1800 seconds is 30 minutes, you have to add 100 for some reason)
The socket remembers this setting.
I can turn it on with an MQTT message ON.
I can turn it off with an MQTT message OFF.
Or it will turn itself off after 30 minutes even if the network, MQTT broker or Node-red server go down.
For resilience in the face of power cuts I make sure that the start-up relay state is OFF.