Need someone to look at a bit of a flow for boot detection

There are two parts to the flow.....
(Well, a lot more but I shall keep it as simple as possible.)

There are foreign nodes - sorry - but they don't do that much important.

The idea:

Normally every n seconds a pulse happens. A file is written to with the time and how long the machine has been running.

The machine boots.

This file is moved/renamed to a file which has the date/time in its name.

Then the original file I mentioned above is re-created with how long it has been running.

I thought I had it working, but today the machine had locked up and I had to power cycle it. :frowning: (Headless.)

It booted but after it did all that, the file which was renamed/moved is empty.

I have changed a bit (see comment node read me for what I did.)

So here is the bits of the flow.

[{"id":"8d34d18c.a5c1d8","type":"subflow","name":"Time Stamp","info":"","category":"","in":[{"x":80,"y":100,"wires":[{"id":"e238745c.805ad"}]}],"out":[{"x":780,"y":180,"wires":[{"id":"e238745c.805ad","port":0},{"id":"f4d2e3a6.04b528","port":0}]},{"x":780,"y":230,"wires":[{"id":"e238745c.805ad","port":0},{"id":"f24c822.a42738","port":0}]},{"x":780,"y":280,"wires":[{"id":"5da44411.ed02ac","port":0},{"id":"e238745c.805ad","port":0}]}],"env":[],"color":"#FF8888","outputLabels":["For logging use","msg.time","For filename use"],"icon":"node-red/timer.svg"},{"id":"f4d2e3a6.04b528","type":"moment","z":"8d34d18c.a5c1d8","name":"","topic":"","input":"","inputType":"msg","inTz":"Australia/Sydney","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYY-MM-DD HH:mm:ss","locale":"en_AU","output":"","outputType":"msg","outTz":"Australia/Sydney","x":400,"y":180,"wires":[["5da44411.ed02ac","3a4de0cb.6235d"]]},{"id":"5da44411.ed02ac","type":"string","z":"8d34d18c.a5c1d8","name":"","methods":[{"name":"replaceAll","params":[{"type":"str","value":":"},{"type":"str","value":""}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":450,"y":280,"wires":[[]]},{"id":"3a4de0cb.6235d","type":"change","z":"8d34d18c.a5c1d8","name":"TOPIC","rules":[{"t":"move","p":"payload","pt":"msg","to":"time","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":230,"y":230,"wires":[["f24c822.a42738"]]},{"id":"e584e350.1d8a48","type":"change","z":"8d34d18c.a5c1d8","name":"Save","rules":[{"t":"set","p":"payload","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":230,"y":140,"wires":[["3411b340.b65a04"]]},{"id":"f24c822.a42738","type":"change","z":"8d34d18c.a5c1d8","name":"Get","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":230,"wires":[[]]},{"id":"e238745c.805ad","type":"switch","z":"8d34d18c.a5c1d8","name":"check topic","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"TIMESTAMP","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":210,"y":100,"wires":[[],["e584e350.1d8a48"]]},{"id":"3411b340.b65a04","type":"change","z":"8d34d18c.a5c1d8","name":"TimeStamp","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":210,"y":180,"wires":[["f4d2e3a6.04b528"]]},{"id":"d2674e15.8bd928","type":"link in","z":"e2bd5a4e.5597e8","name":"","links":["6842a3d4.92d834"],"x":175,"y":1440,"wires":[["bd376285.3f55e8","5110f4eb.035fec"]]},{"id":"59ab137d.00f4cc","type":"debug","z":"e2bd5a4e.5597e8","name":"Uptime output","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":470,"y":1390,"wires":[]},{"id":"bd376285.3f55e8","type":"exec","z":"e2bd5a4e.5597e8","command":"uptime -p","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":290,"y":1440,"wires":[["59ab137d.00f4cc","7d250f73.71ac28"],[],[]]},{"id":"221fb42a.4de824","type":"inject","z":"e2bd5a4e.5597e8","name":"Test","topic":"","payload":"wipe","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":1490,"wires":[["bd376285.3f55e8"]],"icon":"node-red/alert.png"},{"id":"6fd6e6b7.205158","type":"ui_text","z":"e2bd5a4e.5597e8","group":"474a4b8a.7edac4","order":3,"width":"7","height":"1","name":"Up Time","label":"","format":"{{msg.payload}}","layout":"row-spread","x":640,"y":1440,"wires":[]},{"id":"184a239.cadd4dc","type":"ui_text","z":"e2bd5a4e.5597e8","d":true,"group":"474a4b8a.7edac4","order":4,"width":"1","height":"1","name":"Boot indicator","label":"","format":"{{msg.payload}}","layout":"row-right","x":500,"y":1750,"wires":[]},{"id":"def28b0f.2e3c98","type":"ui_button","z":"e2bd5a4e.5597e8","d":true,"name":"Ack Boot","group":"474a4b8a.7edac4","order":2,"width":"1","height":"1","passthru":false,"label":"Ack","tooltip":"","color":"{{msg.font}}","bgcolor":"{{msg.colour}}","icon":"","payload":"1","payloadType":"num","topic":"","x":150,"y":1850,"wires":[["64ea8239.2c430c"]]},{"id":"4119e046.53434","type":"function","z":"e2bd5a4e.5597e8","name":"Boot Ack","func":"if (msg.payload === 0)\n{\n    msg  = {payload: '<font color = \\\"yellow\\\"><i class=\"fa fa-asterisk fa-2x\"></i></font>'};\n    msg1 = {colour: \"yellow\",font:\"black\",txt: \"Rebooted\"};\n}  else\nif (msg.payload === 1)\n{\n    msg  = {payload: '<font color = \\\"grey\\\"><i class=\"fa fa-asterisk fa-2x\"></i></font>'};\n    msg1 = {colour: \"grey\",font:\"black\",txt: \"All good\"};\n}\nreturn [msg, msg1];","outputs":2,"noerr":0,"x":330,"y":1750,"wires":[["401058be.0ec18","184a239.cadd4dc"],["def28b0f.2e3c98","f5ce722c.c6544"]]},{"id":"c28fb23e.dfc578","type":"inject","z":"e2bd5a4e.5597e8","name":"Boot detector","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":"5","x":150,"y":1750,"wires":[["4119e046.53434","bb83d312.6ec39","c4433e3d.391a38"]]},{"id":"64ea8239.2c430c","type":"fan","z":"e2bd5a4e.5597e8","x":310,"y":1810,"wires":[["4119e046.53434"]]},{"id":"401058be.0ec18","type":"debug","z":"e2bd5a4e.5597e8","name":"Uptime output","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":500,"y":1790,"wires":[]},{"id":"c0733e8c.a027c","type":"inject","z":"e2bd5a4e.5597e8","name":"Test","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":1890,"wires":[["64ea8239.2c430c"]],"icon":"node-red/alert.png"},{"id":"8bdc0d7a.cf4a5","type":"inject","z":"e2bd5a4e.5597e8","name":"Test","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":1930,"wires":[["64ea8239.2c430c"]],"icon":"node-red/alert.png"},{"id":"43f6300.38e36d","type":"inject","z":"e2bd5a4e.5597e8","name":"Test","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"5","x":310,"y":1860,"wires":[["bb83d312.6ec39"]]},{"id":"395bcb32.486cf4","type":"function","z":"e2bd5a4e.5597e8","name":"build msg","func":"var path = global.get(\"log_paths\");\nmsg.path = path + \"reboot/\";\n\nmsg.payload = \"Rebooted at \" + msg.payload + \".db\";\nnode.status(msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":810,"y":1830,"wires":[["8283821d.37a61","b36ca576.d1e56","1d04ca5e.062c56"]]},{"id":"b36ca576.d1e56","type":"simple-queue","z":"e2bd5a4e.5597e8","name":"queue1","firstMessageBypass":false,"bypassInterval":"0","x":810,"y":1960,"wires":[["a3d09e07.f45dd"]]},{"id":"8283821d.37a61","type":"fs-ops-move","z":"e2bd5a4e.5597e8","name":"","sourcePath":"/home/pi/.node-red/public/logs/reboot/","sourcePathType":"str","sourceFilename":"last_alive.db","sourceFilenameType":"str","destPath":"/home/pi/.node-red/public/logs/reboot/","destPathType":"str","destFilename":"payload","destFilenameType":"msg","link":false,"x":1060,"y":1830,"wires":[["40c9f592.b31cc4","d31af7be.40b82"]]},{"id":"c98f04e1.97f5c8","type":"change","z":"e2bd5a4e.5597e8","name":"Wipe","rules":[{"t":"set","p":"reset","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":2050,"wires":[["b36ca576.d1e56"]]},{"id":"da6245cf.64188","type":"change","z":"e2bd5a4e.5597e8","name":"Read","rules":[{"t":"set","p":"trigger","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":2010,"wires":[["b36ca576.d1e56"]]},{"id":"a3d09e07.f45dd","type":"debug","z":"e2bd5a4e.5597e8","name":"Filename problems?","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1000,"y":1960,"wires":[]},{"id":"11f0dcc7.b38f33","type":"inject","z":"e2bd5a4e.5597e8","name":"Wipe","topic":"","payload":" ","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":670,"y":2050,"wires":[["c98f04e1.97f5c8"]]},{"id":"8b65501.cbabcb","type":"inject","z":"e2bd5a4e.5597e8","name":"Read","topic":"","payload":" ","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":670,"y":2010,"wires":[["da6245cf.64188"]]},{"id":"b3b48055.7865c8","type":"function","z":"e2bd5a4e.5597e8","name":"build msg","func":"msg.payload = msg.payload + \"\\n\" + flow.get(\"Uptime\");\nvar path = global.get(\"log_paths\");\nmsg.filename = path + \"reboot/\" + \"last_alive.db\";\n//msg.payload = msg.time;\nreturn msg;\n","outputs":1,"noerr":0,"x":450,"y":1490,"wires":[["8c1f7b5f.ef3038"]]},{"id":"8c1f7b5f.ef3038","type":"gate","z":"e2bd5a4e.5597e8","name":"","controlTopic":"control","defaultState":"closed","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":630,"y":1490,"wires":[["834d8c11.8c0078","b5aa2a9f.6788c8"]]},{"id":"834d8c11.8c0078","type":"file","z":"e2bd5a4e.5597e8","name":"Alive","filename":"","appendNewline":true,"createDir":true,"overwriteFile":"true","encoding":"none","x":800,"y":1490,"wires":[[]]},{"id":"4689a7ba.e2b6d8","type":"function","z":"e2bd5a4e.5597e8","name":"set","func":"msg.payload = \"open\";\nmsg.topic = \"control\";\nreturn msg;","outputs":1,"noerr":0,"x":800,"y":1540,"wires":[["8c1f7b5f.ef3038"]]},{"id":"a8bf8fc2.8d44e","type":"delay","z":"e2bd5a4e.5597e8","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":810,"y":1580,"wires":[["4689a7ba.e2b6d8"]]},{"id":"ce97a950.51a79","type":"inject","z":"e2bd5a4e.5597e8","name":"Read","topic":"","payload":" ","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":1070,"y":1880,"wires":[["60a77efb.3d7ed8"]]},{"id":"60a77efb.3d7ed8","type":"change","z":"e2bd5a4e.5597e8","name":"Read","rules":[{"t":"set","p":"trigger","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1230,"y":1880,"wires":[["40c9f592.b31cc4"]]},{"id":"2c3dcc3b.2bc004","type":"inject","z":"e2bd5a4e.5597e8","name":"Wipe","topic":"","payload":" ","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":1070,"y":1920,"wires":[["59a6e154.aab888"]]},{"id":"59a6e154.aab888","type":"change","z":"e2bd5a4e.5597e8","name":"Wipe","rules":[{"t":"set","p":"reset","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1230,"y":1920,"wires":[["40c9f592.b31cc4"]]},{"id":"40c9f592.b31cc4","type":"simple-queue","z":"e2bd5a4e.5597e8","name":"queue1","firstMessageBypass":false,"bypassInterval":"0","x":1240,"y":1830,"wires":[["bf65c694.a1c99"]]},{"id":"bf65c694.a1c99","type":"debug","z":"e2bd5a4e.5597e8","name":"Filename problems?","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1430,"y":1830,"wires":[]},{"id":"bb83d312.6ec39","type":"gate","z":"e2bd5a4e.5597e8","name":"","controlTopic":"control1","defaultState":"open","openCmd":"go","closeCmd":"stop","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":470,"y":1830,"wires":[["d66a7153.6bb9e"]]},{"id":"d287595.8b16ea8","type":"inject","z":"e2bd5a4e.5597e8","name":"Stop","topic":"control1","payload":"stop","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"5","x":310,"y":1900,"wires":[["bb83d312.6ec39"]]},{"id":"5aba3f8e.145a8","type":"inject","z":"e2bd5a4e.5597e8","name":"Go","topic":"control1","payload":"go","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"5","x":310,"y":1940,"wires":[["bb83d312.6ec39"]]},{"id":"c4433e3d.391a38","type":"link out","z":"e2bd5a4e.5597e8","name":"BOOT signal","links":["59e4f77.b581108","ca40f43f.c40ec8","ea9d49aa.0b1c6","e8c5486c.941058","515e67a9.0506e"],"x":340,"y":1710,"wires":[],"l":true},{"id":"aa91bc1e.79937","type":"inject","z":"e2bd5a4e.5597e8","name":"Stop","topic":"control1","payload":"stop","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"5","x":270,"y":1540,"wires":[["ad49d2dc.adabd8"]]},{"id":"48423cbb.3e65dc","type":"inject","z":"e2bd5a4e.5597e8","name":"Go","topic":"control1","payload":"go","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"5","x":270,"y":1580,"wires":[["ad49d2dc.adabd8"]]},{"id":"ad49d2dc.adabd8","type":"gate","z":"e2bd5a4e.5597e8","name":"OLD way","controlTopic":"control1","defaultState":"closed","openCmd":"go","closeCmd":"stop","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":450,"y":1580,"wires":[["a8bf8fc2.8d44e"]]},{"id":"b5aa2a9f.6788c8","type":"debug","z":"e2bd5a4e.5597e8","name":"Time","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":800,"y":1450,"wires":[]},{"id":"d66a7153.6bb9e","type":"subflow:8d34d18c.a5c1d8","z":"e2bd5a4e.5597e8","name":"","x":620,"y":1830,"wires":[[],[],["395bcb32.486cf4","e9fdce0.b92183"]]},{"id":"1d04ca5e.062c56","type":"debug","z":"e2bd5a4e.5597e8","name":"Filename","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":810,"y":1880,"wires":[]},{"id":"5110f4eb.035fec","type":"subflow:8d34d18c.a5c1d8","z":"e2bd5a4e.5597e8","name":"","x":290,"y":1490,"wires":[["b3b48055.7865c8"],[],[]]},{"id":"ea9d49aa.0b1c6","type":"link in","z":"e2bd5a4e.5597e8","name":"Boot Signal","links":["c4433e3d.391a38"],"x":520,"y":1710,"wires":[[]],"l":true},{"id":"7d250f73.71ac28","type":"change","z":"e2bd5a4e.5597e8","name":"Uptime","rules":[{"t":"set","p":"Uptime","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":1440,"wires":[["6fd6e6b7.205158"]]},{"id":"f5ce722c.c6544","type":"ui_template","z":"e2bd5a4e.5597e8","group":"474a4b8a.7edac4","name":"Ack Boot","order":1,"width":"2","height":"1","format":"<div id=\"GButtonM_AckBoot\">\n    <md-button style=\"background-color:{{msg.colour}}; color:{{msg.font}}\" class=\"md-button program-names bold\">{{msg.txt}}\n    </md-button>\n</div>\n\n<script>\n\n(function($scope) {\n\n$('#GButtonM_AckBoot').on('click', function(e) {\n    e.preventDefault(); //prevent default behavior\n    $scope.send({\"topic\":\"momentary_regular\",\"payload\":1});\n});\n    \n})(scope);\n</script>","storeOutMessages":true,"fwdInMessages":false,"resendOnRefresh":true,"templateScope":"local","x":150,"y":1810,"wires":[["64ea8239.2c430c"]]},{"id":"8cf782a8.33b69","type":"ui_template","z":"e2bd5a4e.5597e8","group":"23a81b35.dd43ac","name":"CSS stuff","order":45,"width":0,"height":0,"format":"<style id=\"program-names\">\n    .nr-dashboard-template {\n        padding: 0px;\n    }\n\n/*    \n    .program-names.disabled{\n        cursor: not-allowed;\n        pointer-events: none;\n        color: #aaaaaa !important;\n    }\n    \n    .program-names:not([disabled]):hover{\n         background-color: #232323 !important;\n    }\n*/\n    /*   This is the normal button definition  */\n    .program-names{\n        background-color: var(--program-names-background);\n        color: var(--program-names-foreground);\n        height: var(--dashboard-unit-height);\n        width: 100%;\n        border-radius: 10px;\n        font-size 0.8em;\n        font-weight:normal;\n        margin: 0;\n        min-height: 36px;\n        min-width: unset;\n        line-height: unset;\n        }\n    /*  This is a sub-set which is invoked by */\n    /*  <md-button class=\"md-button program-names bigger\"> */\n    /*  note the (space) \"bigger\" at the end.  */\n    .program-names.bigger{\n        font-weight:bold;\n        font-size:1.5em;\n    }\n    /*  This is for buttons with a lot of text.  `font-size:0.7em` */\n    /*  makes the font 70% normal size  */\n    .program-names.small{\n        font-size:0.7em;\n    }\n    .program-names.bold{\n        font-weight:bold;\n    }\n    /*  This is for buttons with just icons, to upsize the size */\n    /*  of the icon with the line: */\n    /*  <i class=\"fa fa-fw fa-plus remote-icon\"> in the other node  */\n    .remote-icon{\n        font-size:2.0em;\n    }\n    /*  This is the same as the other one, but it makes the icon smaller  */\n    .remote-iconS{\n        font-size:0.5em;\n    }\n\n    .program-names.black{\n        background-color: var(--program-names-background) !important;\n        color: var(--program-names-foreground) !important;\n    }\n\n    .program-names.red{\n        background-color: red !important;\n        color: var(--program-names-foreground) !important;\n    }\n    .program-names.red:not([disabled]):hover{\n         background-color: orange !important;\n    }\n    \n    .program-names.darkred{\n        background-color: darkred !important;\n        color: black !important;\n    }\n    .font-black{\n        color: black;\n    }\n\n</style>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"global","x":150,"y":1700,"wires":[[]]},{"id":"56047bb4.a80b2c","type":"comment","z":"e2bd5a4e.5597e8","name":"Read Me *","info":"Old settings - output from `Time Stamp` to start time for enabling `last alive.db` file writing.\nNew settings - output from `file move` node to signal the enabling of `last alive.db`.","x":700,"y":1740,"wires":[]},{"id":"13174820.5236d8","type":"inject","z":"e2bd5a4e.5597e8","name":"Stop","topic":"control1","payload":"stop","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"5","x":270,"y":1620,"wires":[["af18b37.e7cd95"]]},{"id":"f977b28.11b1b5","type":"inject","z":"e2bd5a4e.5597e8","name":"Go","topic":"control1","payload":"go","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"5","x":270,"y":1660,"wires":[["af18b37.e7cd95"]]},{"id":"af18b37.e7cd95","type":"gate","z":"e2bd5a4e.5597e8","name":"NEW way","controlTopic":"control1","defaultState":"open","openCmd":"go","closeCmd":"stop","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":450,"y":1620,"wires":[["a8bf8fc2.8d44e"]]},{"id":"a5e09ecc.e66438","type":"link in","z":"e2bd5a4e.5597e8","name":"","links":["e9fdce0.b92183"],"x":405,"y":1540,"wires":[["ad49d2dc.adabd8"]]},{"id":"e9fdce0.b92183","type":"link out","z":"e2bd5a4e.5597e8","name":"","links":["a5e09ecc.e66438"],"x":745,"y":1790,"wires":[]},{"id":"d31af7be.40b82","type":"link out","z":"e2bd5a4e.5597e8","name":"","links":["36932a59.1deaae"],"x":1195,"y":1790,"wires":[]},{"id":"36932a59.1deaae","type":"link in","z":"e2bd5a4e.5597e8","name":"","links":["d31af7be.40b82"],"x":405,"y":1670,"wires":[["af18b37.e7cd95"]]},{"id":"3587609a.38ecc","type":"comment","z":"e2bd5a4e.5597e8","name":"Uptime display","info":"","x":280,"y":1370,"wires":[]},{"id":"474a4b8a.7edac4","type":"ui_group","z":"","name":"Up Time","tab":"173dcde5.96e88a","order":4,"disp":true,"width":"9","collapse":false},{"id":"23a81b35.dd43ac","type":"ui_group","z":"","name":"Main Menu Desktop machines","tab":"9d59e7da.0366c8","order":1,"disp":true,"width":"8","collapse":false},{"id":"173dcde5.96e88a","type":"ui_tab","z":"","name":"Local Readings","icon":"dvr","order":3,"disabled":false,"hidden":false},{"id":"9d59e7da.0366c8","type":"ui_tab","z":"","name":"Main Menu","icon":"list","order":1,"disabled":false,"hidden":false}]

The only external thing you will see is at the top of the nodes link in is the pulse that is used as the signal to generate the time stamp.

There are a couple of disabled nodes which are because I am playing with CSS and those nodes have been superseded.

There is a lot of debug stuff. That is the lower right part. The queue nodes.

In the middle there are two gate nodes. Old way and New way.

(See the Read Me)

Basically the output from my subflow timestamp node started the timer node to turn on the gate node that allows writing to the last alive file. (Top right of the flow)

But I decided to maybe take the output signal from the move node that Moves (renames) the file.

Still not tested.

Thanks in advance and I hope you understand what I want to do and how/why.

:slight_smile:

I haven't concentrated enough to attempt to understand your flow yet, apologies for that, but I'd like to ask why this approach? You could use the crontab of the machine, and start a command at (re)boot time as executed and have it write the timestamp that way. Then in node-red read it out/do something with it. It might be more stable than the flow you use here.
This is a good tutorial on how to use @reboot /path/to/command in crontab on a linux system such as a pi.

Additionally,

The problem is that the name of the file is created in NR. So, I guess it could be done but it would require me to learn more on that part of things.

This is/was something I wrote a fair while ago. I have just tweaked it to be a bit better.

This is an example of what the file looks like:

2020-06-20 21:23:07
up 1 hour, 20 minutes

And although this points the finger that the code is the problem.

But.....

-rw-r--r-- 1 pi pi  51 May 14 15:38 Rebooted at 2020-05-14 154015.db
-rw-r--r-- 1 pi pi  60 May 21 10:11 Rebooted at 2020-05-21 102158.db
-rw-r--r-- 1 pi pi  34 May 21 10:23 Rebooted at 2020-05-21 104603.db
-rw-r--r-- 1 pi pi  52 May 27 23:31 Rebooted at 2020-05-27 233350.db
-rw-r--r-- 1 pi pi  50 May 28 18:29 Rebooted at 2020-05-28 183145.db
-rw-r--r-- 1 pi pi  60 May 31 13:41 Rebooted at 2020-05-31 134335.db
-rw-r--r-- 1 pi pi  61 Jun  2 09:07 Rebooted at 2020-06-02 082015.db
-rw-r--r-- 1 pi pi  52 Jun  9 13:39 Rebooted at 2020-06-09 134200.db
-rw-r--r-- 1 pi pi  61 Jun 15 00:33 Rebooted at 2020-06-15 003604.db
-rw-r--r-- 1 pi pi   0 Jun 20 19:49 Rebooted at 2020-06-20 192105.db

So for some reason the rename got corrupted.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.