I have to admit I’ve never seen them before, but there are supposed to be so-called dead-man switches on trains.
These switches with the somewhat macabre name are a whole sensible invention. These switches must be pressed again and again by the driver within a certain time. If the driver forgets this, for example because he is physically unable to do so, a warning signal sounds first and if the driver still does not press the appropriate button, the train automatically brakes.
This system ensures that a train is never on the road and the helm is always there.
What makes sense in train traffic can only be helpful in a SmartHome system.
There you can use this procedure – in a slightly modified form – also.
For example, this procedure would allow the radiator to be turned on whenever a particular device sends messages at a fixed interval. As soon as these messages are missing, the radiator is switched off again.
For example, I use it at my desk. When the socket of my desk is switched on, the SmartHome reacts to the regularly sent info messages from a Tasmota device and automatically switches on the heating in the room. As soon as the desk is switched off again, the regular info messages will remain off and the SmartHome will switch off the heater.
This example explains how to use the status messages of a Tasmota device. Because they send a status message to the standard topic “tele/NAME/STATE” within an adjustable interval – by default five minutes. This turns on another Tasmota lamp. If the original Tasmota device does not send a signal for more than five minutes – to be precise five minutes and ten seconds – the Tasmota lamp will be switched off again.
How you implement this is explained in the following article.
Hints for our lovely english readers: Basically, many of the articles on Nerdiy.de are translations from the original german articles. Therefore, it may happen here and there that some illustrations are not available in english and that some translations are weird/strange/full of mistakes or generally totaly wrong. So if you find some obvious (or also not obvious) mistakes don't hesitate to leave us a hint about that in the comment section.
Also please don't get confused, that instead of a "dot" often a "comma" is used as decimal separator. 🙂
Inhalte
Safety instructions
I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/en/sicherheitshinweise/
Affiliate links / advertising links
The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and shop via this link, Nerdiy.de receives a commission from the online shop or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support Nerdiy.de in being able to offer further useful projects in the future. 🙂
Requirements
Helpful Articles:
Of course NodeRed should already be installed so that you can take over this configuration.
How to prepare a RaspberryPi and then install NodeRed on it, is described in the following articles.
RaspberryPi – Setting up for Nerdiys!
RaspberryPi – The first configuration
RaspberryPi – Controlling the RaspberryPi via SSH
NodeRed – Installing NodeRed on the RaspberryPi
NodeRed – Install New Nodes
Required tools:
-none-
Required material:
In the following list you will find all the parts you need to implement this article.
Log in to the NodeRed configuration interface
Before you can edit your NodeRed configuration you must - if activated - first log in to the NodeRed configuration interface.

Import Node Code
To try this example, you need to import the following node code into your NodeRed installation.


Node-Code:
[{"id":"e2fc26ae.3ff008","type":"mqtt in","z":"4131a41e.b9233c","name":"","topic":"tele/MiniLichterkette/STATE","qos":"2","broker":"3c2a29eb.148006","x":380,"y":1380,"wires":[["a5563ed4.23a7e"]]},{"id":"60f3b2d3.5c1c5c","type":"inject","z":"4131a41e.b9233c","name":"check time","topic":"","payload":"check","payloadType":"str","repeat":"1","crontab":"","once":true,"onceDelay":0.1,"x":430,"y":1420,"wires":[["a5563ed4.23a7e"]]},{"id":"a5563ed4.23a7e","type":"function","z":"4131a41e.b9233c","name":"check","func":"if (msg.payload==\"check\")\n{\n if ((Date.now()-context.flow.signalTimestamp)>310000)\n {\n context.flow.signalTimestamp=0;\n msg.payload=false;\n } else\n {\n msg.payload=true;\n }\n} else\n{\n context.flow.signalTimestamp=Date.now();\n msg.payload=true;\n}\nreturn msg;","outputs":1,"noerr":0,"x":600,"y":1400,"wires":[["3ab4ab0f.883254","d2419bcd.1368d8"]]},{"id":"3ab4ab0f.883254","type":"trigger","z":"4131a41e.b9233c","op1":"ON","op2":"0","op1type":"str","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"false","bytopic":"all","name":"","x":800,"y":1380,"wires":[["4d720e6.97ee2f","b05ef19f.d9d03"]]},{"id":"d2419bcd.1368d8","type":"trigger","z":"4131a41e.b9233c","op1":"OFF","op2":"0","op1type":"str","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"true","bytopic":"all","name":"","x":800,"y":1420,"wires":[["4d720e6.97ee2f","b05ef19f.d9d03"]]},{"id":"4d720e6.97ee2f","type":"debug","z":"4131a41e.b9233c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1010,"y":1460,"wires":[]},{"id":"b05ef19f.d9d03","type":"mqtt out","z":"4131a41e.b9233c","name":"","topic":"cmnd/GluehbirnenLampe40W/POWER","qos":"","retain":"","broker":"3c2a29eb.148006","x":1120,"y":1420,"wires":[]},{"id":"3c2a29eb.148006","type":"mqtt-broker","z":"","name":"Server-Mqtt","broker":"server.fritz.box","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂
Fab
P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂
