WARNING MainThread RFM2Pi thread is dead

Yeh I have this, I started a thread a while ago but couldn’t find the cause EmonHUB Crashing - #24 by Dave
The way I overcame this is by putting a watchdog on NodeRED that monitors the update of my emonpi and if it exceeds 60 secs it restarts emonhub service and pushes me a message.
Every now and again thou it crashes and the watchdog doesn’t pick it up.
Just import the below code into NodeRED…

Regards
Dave

[{“id”:“9936972b.8753f8”,“type”:“pushover”,“z”:“a5ce04b2.5a31f8”,“name”:“Pushover”,“device”:"",“title”:“Node-RED”,“priority”:0,“sound”:“pushover”,“url”:"",“url_title”:"",“x”:977.78564453125,“y”:375.59124755859375,“wires”:[]},{“id”:“74c97519.99dcdc”,“type”:“mqtt in”,“z”:“a5ce04b2.5a31f8”,“name”:“Watchdog”,“topic”:“emon/emonpi/TotalGeneration”,“qos”:“2”,“broker”:“a06667e4.71e22”,“x”:75.70233154296875,“y”:431.24600982666016,“wires”:[[“11da4deb.ffda1a”,“a88f159e.1b5d28”]]},{“id”:“11da4deb.ffda1a”,“type”:“trigger”,“z”:“a5ce04b2.5a31f8”,“op1”:"",“op2”:“Emoncms has stopped updating!”,“op1type”:“nul”,“op2type”:“str”,“duration”:“60”,“extend”:true,“units”:“s”,“reset”:"",“name”:“Wait 60 Secs”,“x”:279.7023162841797,“y”:414.24600982666016,“wires”:[[“326f6f17.065868”,“e6a5be2.31155c”]]},{“id”:“326f6f17.065868”,“type”:“delay”,“z”:“a5ce04b2.5a31f8”,“name”:“5 Sec Delay”,“pauseType”:“delay”,“timeout”:“5”,“timeoutUnits”:“seconds”,“rate”:“1”,“rateUnits”:“second”,“randomFirst”:“1”,“randomLast”:“5”,“randomUnits”:“seconds”,“drop”:false,“x”:264.7023162841797,“y”:478.24600982666016,“wires”:[[“11da4deb.ffda1a”]]},{“id”:“e6a5be2.31155c”,“type”:“delay”,“z”:“a5ce04b2.5a31f8”,“name”:“Limit Messages”,“pauseType”:“rate”,“timeout”:“5”,“timeoutUnits”:“seconds”,“rate”:“1”,“rateUnits”:“minute”,“randomFirst”:“1”,“randomLast”:“5”,“randomUnits”:“seconds”,“drop”:true,“x”:463.70233154296875,“y”:430.24600982666016,“wires”:[[“cb7c12af.69c4f”,“9936972b.8753f8”,“57380ccf.2fb024”]]},{“id”:“55abcfae.660fb8”,“type”:“comment”,“z”:“a5ce04b2.5a31f8”,“name”:“Emoncms Watchdog”,“info”:"",“x”:117.70233154296875,“y”:378.24600982666016,“wires”:[]},{“id”:“57380ccf.2fb024”,“type”:“exec”,“z”:“a5ce04b2.5a31f8”,“command”:“sudo service emonhub restart”,“addpay”:true,“append”:"",“useSpawn”:"",“name”:“Reset emonHub”,“x”:726.9522552490234,“y”:481.9960708618164,“wires”:[[],[],[]]},{“id”:“da8c97ba.3b91b”,“type”:“inject”,“z”:“a5ce04b2.5a31f8”,“name”:“Restart emonHub Now?”,“topic”:"",“payload”:"",“payloadType”:“date”,“repeat”:"",“crontab”:"",“once”:false,“x”:493.45225524902344,“y”:481.24600982666016,“wires”:[[“57380ccf.2fb024”]]},{“id”:“ccf9ca21.a8c25”,“type”:“file”,“z”:“a5ce04b2.5a31f8”,“name”:“Logfile”,“filename”:"/home/pi/watchdog.txt",“appendNewline”:true,“createDir”:false,“overwriteFile”:“false”,“x”:808.7023315429688,“y”:430.24600982666016,“wires”:[]},{“id”:“cb7c12af.69c4f”,“type”:“function”,“z”:“a5ce04b2.5a31f8”,“name”:“Add datestamp”,“func”:“var datestamp = Date();\nmsg.payload = ((“RFM2Pi Reset script called - “) + (datestamp));\nreturn msg;”,“outputs”:1,“noerr”:0,“x”:658.7023315429688,“y”:430.24600982666016,“wires”:[[“ccf9ca21.a8c25”]]},{“id”:“a88f159e.1b5d28”,“type”:“trigger”,“z”:“a5ce04b2.5a31f8”,“op1”:””,“op2”:“Emoncms has crashed!”,“op1type”:“nul”,“op2type”:“str”,“duration”:“5”,“extend”:true,“units”:“min”,“reset”:"",“name”:“Wait 5 Mins”,“x”:485.7023162841797,“y”:525.2460403442383,“wires”:[[“fbeb29f8.631688”,“ca133f4a.e7ca”,“9936972b.8753f8”,“a2f784f0.808498”]]},{“id”:“fbeb29f8.631688”,“type”:“delay”,“z”:“a5ce04b2.5a31f8”,“name”:“5 Sec Delay”,“pauseType”:“delay”,“timeout”:“5”,“timeoutUnits”:“seconds”,“rate”:“1”,“rateUnits”:“second”,“randomFirst”:“1”,“randomLast”:“5”,“randomUnits”:“seconds”,“drop”:false,“x”:482.7023162841797,“y”:572.2460098266602,“wires”:[[“a88f159e.1b5d28”]]},{“id”:“a2f784f0.808498”,“type”:“exec”,“z”:“a5ce04b2.5a31f8”,“command”:“sudo reboot”,“addpay”:true,“append”:"",“useSpawn”:"",“timer”:"",“name”:“Reboot”,“x”:696.9522552490234,“y”:593.9960708618164,“wires”:[[],[],[]]},{“id”:“a9976826.0c7a4”,“type”:“inject”,“z”:“a5ce04b2.5a31f8”,“name”:“Reboot Now?”,“topic”:"",“payload”:"",“payloadType”:“date”,“repeat”:"",“crontab”:"",“once”:false,“x”:503.45225524902344,“y”:615.2460098266602,“wires”:[[“a2f784f0.808498”]]},{“id”:“816d1cc0.42e048”,“type”:“file”,“z”:“a5ce04b2.5a31f8”,“name”:“Logfile”,“filename”:"/home/pi/watchdog.txt",“appendNewline”:true,“createDir”:false,“overwriteFile”:“false”,“x”:856.7023162841797,“y”:529.2460403442383,“wires”:[]},{“id”:“ca133f4a.e7ca”,“type”:“function”,“z”:“a5ce04b2.5a31f8”,“name”:“Add datestamp”,“func”:“var datestamp = Date();\nmsg.payload = ((“RFM2Pi Reset script called - “) + (datestamp));\nreturn msg;”,“outputs”:1,“noerr”:0,“x”:706.7023162841797,“y”:530.2460403442383,“wires”:[[“816d1cc0.42e048”]]},{“id”:“a06667e4.71e22”,“type”:“mqtt-broker”,“z”:””,“broker”:“127.0.0.1”,“port”:“1883”,“clientid”:"",“usetls”:false,“compatmode”:true,“keepalive”:“15”,“cleansession”:true,“willTopic”:"",“willQos”:“0”,“willPayload”:"",“birthTopic”:"",“birthQos”:“0”,“birthPayload”:""}]