COMPASS_backup to Dropbox

This flow is a Node-RED option for backing up .csv files . This is provided as part of an an update to a research paper describing a basic system for monitoring activity and sleep in mice. (https://wellcomeopenresearch.org/articles/1-2/v2). This follows from The COMPASS flow for storing data.

Steps:

Look for changes to files in the defined folder, then backing these up to Dropbox at a rate that can be controlled to ensure you don't connect more often than needed (currently 10 min updates).

The flow also allows for any filename later appended with 'backup' to also be uploaded (allowing for connection issues or recovery).

Using Dropbox node

You will need to setup an Dropbox account, and follow the instructions below to generate an access token.

From the Node info for Dropbox node:

To obtain an access token, visit the Dropbox developer home.

Once signed up: click 'Create app', select 'Dropbox API app', choose either App folder or Full Dropbox access, choose an app name click 'Create app'. On the subsequent page, click the button to generated an access token. Copy it into the box >above.

[{"id":"66b78d.166b2874","type":"dropbox out","z":"6ad42d7a.7bc484","dropbox":"","filename":"","localFilename":"","name":"COMPASS_nodered","x":1009.0000152587891,"y":72.00000190734863,"wires":[]},{"id":"49b0dc4a.4d6b34","type":"watch","z":"6ad42d7a.7bc484","name":"pi_home","files":"/home/pi/","x":94,"y":150,"wires":[["1dfe196f.092247"]]},{"id":"dbdd0b9b.423198","type":"debug","z":"6ad42d7a.7bc484","name":"","active":true,"console":"false","complete":"true","x":1009.0000152587891,"y":190.0000023841858,"wires":[]},{"id":"1dfe196f.092247","type":"switch","z":"6ad42d7a.7bc484","name":"Switch_based on header","property":"file","propertyType":"msg","rules":[{"t":"cont","v":"Box","vt":"str"},{"t":"cont","v":"backup","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":180,"wires":[["70cc9233.df477c"],["dab75357.c37fe"]]},{"id":"a5b25c13.1ed8c","type":"change","z":"6ad42d7a.7bc484","name":"","rules":[{"t":"set","p":"localFilename","to":"msg.payload"},{"t":"delete","p":"payload"},{"t":"set","p":"filename","to":"msg.file"}],"action":"","property":"","from":"","to":"","reg":false,"x":715.0000076293945,"y":116.00000190734863,"wires":[["66b78d.166b2874","dbdd0b9b.423198"]]},{"id":"70cc9233.df477c","type":"delay","z":"6ad42d7a.7bc484","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"6","rateUnits":"hour","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":469.00000762939453,"y":85.00000190734863,"wires":[["a5b25c13.1ed8c","dbdd0b9b.423198"]]},{"id":"4c8cbefd.f0193","type":"dropbox out","z":"6ad42d7a.7bc484","dropbox":"","filename":"","localFilename":"","name":"COMPASS_nodered","x":1093.000015258789,"y":330.00000381469727,"wires":[]},{"id":"cd79e1d2.75914","type":"change","z":"6ad42d7a.7bc484","name":"","rules":[{"t":"set","p":"localFilename","to":"msg.payload"},{"t":"delete","p":"payload"},{"t":"set","p":"filename","to":"msg.file"}],"action":"","property":"","from":"","to":"","reg":false,"x":793.0000114440918,"y":359.00000381469727,"wires":[["4c8cbefd.f0193","dbdd0b9b.423198"]]},{"id":"3ba7729.80f9f8e","type":"delay","z":"6ad42d7a.7bc484","name":"","pauseType":"delay","timeout":"30","timeoutUnits":"seconds","rate":"6","rateUnits":"hour","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":635.0000076293945,"y":282.00000381469727,"wires":[["cd79e1d2.75914"]]},{"id":"dab75357.c37fe","type":"delay","z":"6ad42d7a.7bc484","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"6","rateUnits":"hour","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":452.00000762939453,"y":364.00000381469727,"wires":[["3ba7729.80f9f8e"]]}]

Flow Info

Created 6 years, 9 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x2)
  • debug (x1)
  • delay (x3)
  • switch (x1)
  • watch (x1)
Other
  • dropbox out (x2)

Tags

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