TASMOTA backup using Node-RED

This flow is useful to take automated backups of TASMOTA based devices in the network.

[{"id":"7bfc20c9e14aeac5","type":"tab","label":"Tasmota Backup","disabled":false,"info":"","env":[]},{"id":"fa41546a353a3965","type":"group","z":"7bfc20c9e14aeac5","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["9aa400069e829fd1","a74e577fcb9eeffe","45240497713fa79d","e216beac87478d15","bb51ee9ea6841c51","cf97328b396ae15c","fdb17750c1c35921"],"x":34,"y":59,"w":1252,"h":82},{"id":"9196f3c597f29df6","type":"group","z":"7bfc20c9e14aeac5","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["9fe6b7236b090ac0","53af08eb0e0914a7","646043282acfecaf","49d1d46deb2f19cf","c74caa8881a1a6de","b06ed2473a54cd92"],"x":34,"y":179,"w":972,"h":122},{"id":"6b42b6754232f80b","type":"group","z":"7bfc20c9e14aeac5","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["6bf6631a3676ec21","853a064d7161dd9f","c6ab4c092bda9c9f"],"x":34,"y":339,"w":612,"h":82},{"id":"9aa400069e829fd1","type":"http request","z":"7bfc20c9e14aeac5","g":"fa41546a353a3965","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":550,"y":100,"wires":[["e216beac87478d15"]]},{"id":"a74e577fcb9eeffe","type":"function","z":"7bfc20c9e14aeac5","g":"fa41546a353a3965","name":"Generate IPs","func":"var subnetIP = \"192.168.0.x\"\nfor(var i=1; i <= 255; i++ ){\n    var res = {\n        ip_address: subnetIP.replace(\"x\", String(i)),\n        url: \"http://\" + subnetIP.replace(\"x\", i + \"\") + \"/cm?cmnd=Module\"\n    }\n    node.send(res);\n}\nreturn;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":100,"wires":[["9aa400069e829fd1"]]},{"id":"45240497713fa79d","type":"inject","z":"7bfc20c9e14aeac5","g":"fa41546a353a3965","name":"8 Hrs","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"43200","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":100,"wires":[["a74e577fcb9eeffe"]]},{"id":"e216beac87478d15","type":"function","z":"7bfc20c9e14aeac5","g":"fa41546a353a3965","name":"HTTP 200","func":"if(msg.statusCode === 200){\n    return {payload : msg.ip_address};\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":730,"y":100,"wires":[["cf97328b396ae15c"]]},{"id":"b7f3ec45f1a17ffe","type":"catch","z":"7bfc20c9e14aeac5","name":"","scope":["9aa400069e829fd1","9fe6b7236b090ac0"],"uncaught":false,"x":90,"y":20,"wires":[[]]},{"id":"bb51ee9ea6841c51","type":"debug","z":"7bfc20c9e14aeac5","g":"fa41546a353a3965","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1180,"y":100,"wires":[]},{"id":"cf97328b396ae15c","type":"join","z":"7bfc20c9e14aeac5","g":"fa41546a353a3965","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"20","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":890,"y":100,"wires":[["fdb17750c1c35921"]]},{"id":"fdb17750c1c35921","type":"function","z":"7bfc20c9e14aeac5","g":"fa41546a353a3965","name":"Store","func":"flow.set(\"ip_addresses\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1030,"y":100,"wires":[["bb51ee9ea6841c51"]]},{"id":"9fe6b7236b090ac0","type":"http request","z":"7bfc20c9e14aeac5","g":"9196f3c597f29df6","name":"","method":"GET","ret":"bin","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":550,"y":220,"wires":[["b06ed2473a54cd92"]]},{"id":"53af08eb0e0914a7","type":"file","z":"7bfc20c9e14aeac5","g":"9196f3c597f29df6","name":"","filename":"filename","filenameType":"msg","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"utf8","x":900,"y":220,"wires":[[]]},{"id":"646043282acfecaf","type":"debug","z":"7bfc20c9e14aeac5","g":"9196f3c597f29df6","name":"debug 10","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":900,"y":260,"wires":[]},{"id":"49d1d46deb2f19cf","type":"function","z":"7bfc20c9e14aeac5","g":"9196f3c597f29df6","name":"Tasmota Dev. IPs","func":"var ip_addresses = flow.get(\"ip_addresses\");\nvar date = new Date();\nip_addresses.forEach((ip) =>{\n     node.send({ \n         url: \"http://\" + ip +\"/dl?\",\n         filename: \"/backups/tasmota/\" + (date.getDay() % 2)+\"/\"+ip + \"_\" + date.getFullYear() + date.getMonth() + date.getDay()+\".dmp\"\n        });\n    })\nreturn;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":220,"wires":[["9fe6b7236b090ac0"]]},{"id":"c74caa8881a1a6de","type":"inject","z":"7bfc20c9e14aeac5","g":"9196f3c597f29df6","name":"24 Hrs","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"86400","crontab":"","once":true,"onceDelay":"90","topic":"","payload":"","payloadType":"date","x":140,"y":220,"wires":[["49d1d46deb2f19cf"]]},{"id":"b06ed2473a54cd92","type":"function","z":"7bfc20c9e14aeac5","g":"9196f3c597f29df6","name":"HTTP 200","func":"if(msg.statusCode === 200){\n    return [msg,null]\n}else{\n    return [null,msg]\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":710,"y":220,"wires":[["53af08eb0e0914a7"],["646043282acfecaf"]]},{"id":"c6ab4c092bda9c9f","type":"watch","z":"7bfc20c9e14aeac5","g":"6b42b6754232f80b","name":"Watch backup Dir","files":"/backups/tasmota/","recursive":true,"x":140,"y":380,"wires":[["853a064d7161dd9f"]]},{"id":"853a064d7161dd9f","type":"join","z":"7bfc20c9e14aeac5","g":"6b42b6754232f80b","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"20","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":310,"y":380,"wires":[["6bf6631a3676ec21"]]},{"id":"6bf6631a3676ec21","type":"debug","z":"7bfc20c9e14aeac5","g":"6b42b6754232f80b","name":"debug 11","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":540,"y":380,"wires":[]}]

Flow Info

Created 1 year, 11 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • catch (x1)
  • debug (x3)
  • file (x1)
  • function (x5)
  • http request (x2)
  • inject (x2)
  • join (x2)
  • watch (x1)
Other

Tags

  • TASMOTA
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option