@Jakes To avoid having an operator do this weekly it can be done programmatically with a weekly inject. A lot of the steps are from the other threads linked above, but hopefully this helps tie it all together for a PR1 / PR2 / RIO.
Firstly, you will need to download the email node package since it is no longer a core pre-installed node, and make sure you have an email account with an application password.
Next, get the URL you will need from the hamburger menu, but make sure it has the parameter ?api_key=<YOURAPIKEY>
to be compatible with the http request node. You can replace the hostname with localhost
if you are running the Node-RED flow on the same device as the groov View project.
You’ll also need to authorize the request, you can find a breakdown of that in this forum thread: Authenticating Opto API calls with HTTP request
Once you have the data in Node-RED you’ll need wrap it in the right message properties. That’s covered in the thread Ben linked earlier. It will not write the file to the HDD at any point, it just exists in memory.
Finally, here’s an example flow you can use to get started.
[{"id":"87dd5faefe53415b","type":"tab","label":"Email groov Trend","disabled":false,"info":""},{"id":"dbf5bb3d28d5b26a","type":"e-mail","z":"87dd5faefe53415b","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"address@gmail.com","dname":"","credentials":{},"x":760,"y":120,"wires":[]},{"id":"0a1866b58bdfff4c","type":"function","z":"87dd5faefe53415b","name":"set properties","func":"var datestring = new Date().toISOString().substring(0,10);\nvar filestring = \"scanned-data_\" + datestring + \".csv\"\n\n// Set attachment file (utf-8 saved as *.csv)\nmsg.attachments =\n {\n filename : filestring,\n content : msg.payload\n };\n\n// Email subject\nmsg.topic = \"Your Weekly Report for \" + datestring;\n\n// Email body text\nmsg.payload = \"See attached file: `\" + filestring + \"`\";\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":120,"wires":[["eee6d330768dfaf2","dbf5bb3d28d5b26a"]]},{"id":"02049363f73ac611","type":"http request","z":"87dd5faefe53415b","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://localhost/view/api/v0/data-logging/2_0_720_12_false,13_0_720_12_false,1_0_720_12_false/scanned-data.csv?api_key=mR4VG3sRSrRJok4ZouNGJN7iNJQpfKER","tls":"3940dc165d82fa25","persist":false,"proxy":"","authType":"","x":350,"y":120,"wires":[["0a1866b58bdfff4c"]]},{"id":"eee6d330768dfaf2","type":"debug","z":"87dd5faefe53415b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":730,"y":80,"wires":[]},{"id":"e039263cbab8638c","type":"inject","z":"87dd5faefe53415b","name":"8am Monday","props":[],"repeat":"","crontab":"00 08 * * 1","once":false,"onceDelay":0.1,"topic":"","x":160,"y":120,"wires":[["02049363f73ac611"]]},{"id":"3940dc165d82fa25","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false,"alpnprotocol":""}]
Remember to change the inject to whenever you want the report sent, add your own email, and replace the base URL and API key so it works with your tag(s). If you have multiple tags in one trend, like I do in my example, it will show them all as individual columns in the *.csv file.
Please let us know if that gets you going and if you have any follow-up questions.