Hi all,
This would be my first post on the forum and I am trying to gather my knowledge by taking bits and pieces of the forum and internet.
After installing Node-RED (The Script by Peter Scargill) on a Raspberry Pi and I was happily playing and testing with it until it crashed.
I couldn't recover any of my created flows and I was lost and started all over again.
Checking the internet their are two files of importance which would or should contain everything.
My Raspberry Pi is called "Pikea". (YT Andreas Spiess Ikea Tradfri hack)
/home/pi/.node-red/flows_Pikea.json
/home/pi/.node-red/flows_Pikea_cred.json
The first thing I am trying to create now is a automation to backup up two files and send them through email.
Creating the files works ,but I am stuck sending them as an attachment.
[{"id":"4f338c61.443ef4","type":"file in","z":"3a945cb8.53d5b4","name":"flows_pikea.json","filename":"/home/pi/.node-red/flows_Pikea.json","format":"utf8","sendError":true,"x":500,"y":120,"wires":[["3c598934.1b9876"]]},{"id":"eac1ae94.77aee","type":"file","z":"3a945cb8.53d5b4","name":"","filename":"","appendNewline":false,"createDir":false,"overwriteFile":"true","x":870,"y":120,"wires":[["aa600982.a86638"]]},{"id":"3c598934.1b9876","type":"function","z":"3a945cb8.53d5b4","name":"","func":"msg.filename = \"/home/pi/.node-red/backup/backup_\"+(new Date().toISOString().replace(':', '_').replace(':', '_').replace(/\\..+/, ''))+\"_flows_Pikea.json\";\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":120,"wires":[["eac1ae94.77aee"]]},{"id":"12b08589.3ee24a","type":"file in","z":"3a945cb8.53d5b4","name":"flows_pikea_cred.json","filename":"/home/pi/.node-red/flows_Pikea_cred.json","format":"utf8","sendError":true,"x":520,"y":200,"wires":[["a87f56f4.4ae548"]]},{"id":"c33609db.faee18","type":"file","z":"3a945cb8.53d5b4","name":"","filename":"","appendNewline":false,"createDir":false,"overwriteFile":"true","x":870,"y":200,"wires":[["aa600982.a86638"]]},{"id":"a87f56f4.4ae548","type":"function","z":"3a945cb8.53d5b4","name":"","func":"msg.filename = \"/home/pi/.node-red/backup/backup_\"+(new Date().toISOString().replace(':', '_').replace(':', '_').replace(/\\..+/, ''))+\"_flows_Pikea_cred.json\";\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":200,"wires":[["c33609db.faee18"]]},{"id":"aa600982.a86638","type":"e-mail","z":"3a945cb8.53d5b4","server":"smtp.gmail.com","port":"465","secure":true,"name":"email@gmail.com","dname":"email@gmail.com","x":1190,"y":180,"wires":[]},{"id":"992b5b36.cedf68","type":"inject","z":"3a945cb8.53d5b4","name":"","topic":"Inject 1 sec after deploy then every 24hrs","payload":"","payloadType":"date","repeat":"86400","crontab":"","once":true,"onceDelay":"1","x":190,"y":160,"wires":[["4f338c61.443ef4","12b08589.3ee24a"]]}]
p.s., send failed due to removed email for privacy
After deploying it it makes a copy of both files placing them in the backup folder ,but two emails only contains the contents of the files.
I just want a single email with both files attached with a proper subject from which Node-RED and date modified when backup was created.
Any help or guidance would be greatly appreciated.
Thanks.