Node-red to PDF

Now that I have some simple node-red stuff running, here is what I want to do:

Node-Red (on AR1) pulls temperature data from S1/R1 controller(s) > Format into a human legible format (html/text file/whatever) > convert to pdf > save pdf to file server

This only needs to happen every 12 hrs for temperature logging purposes at our facility.
Is this possible? Complicated? Has anyone done anything like this?
Thanks.

Does it have to be a PDF?
I have never used it, but this Node is the only one that I could find that claims that it should be able to do it.

EDIT. Where is the ‘file server’? You might have more fun getting it off the AR1 than making the PDF…

Local PC/Server (ftp folder). It doesn’t have to be PDF. A text file would do, but it needs to be formatted for human consumption.

1 Like

Try this flow.
It should get you started.
Change the int32 ‘counter’ to be the analog input for your temperature.
Change the inject from none, to repeat every 12 hours.
(Note, probably should install the FTP node before you import the flow - node-red-contrib-ftp (node) - Node-RED)

Here is what it looks like;

And here is the flow;

[{"id":"7c44525c.f7ae3c","type":"pac-read","z":"6017ee8f.69be8","device":"8edb7df4.9811b","dataType":"int32-variable","tagName":"counter","tableStartIndex":"","tableLength":"","value":"temperature","valueType":"msg","topic":"","topicType":"none","name":"","x":360,"y":120,"wires":[["b549c5e0.528d58"]]},{"id":"84b774cf.dee888","type":"inject","z":"6017ee8f.69be8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":140,"y":120,"wires":[["7c44525c.f7ae3c","4d179918.41c528"]]},{"id":"b549c5e0.528d58","type":"function","z":"6017ee8f.69be8","name":"Date timestamp temperature 'report'","func":"//get the current date and time\nvar d = new Date();\nvar tstring = ('0'+((d.getHours()+11)%12 + 1)).slice(-2)+':';\ntstring += ('0'+d.getMinutes()).slice(-2) + ((d.getHours() >= 12)? 'PM ':'AM ');\ntstring += d.toString().substring(0,4) + d.toISOString().substring(2,10);\n//Append some example text\ntstring += ' Temperature is ';\nmsg.payload = tstring += msg.temperature;\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":120,"wires":[["ea1be5e5.2625e8"]]},{"id":"ea1be5e5.2625e8","type":"file","z":"6017ee8f.69be8","name":"","filename":"/home/dev/temperature.txt","appendNewline":true,"createDir":false,"overwriteFile":"false","x":935.1666870117188,"y":122,"wires":[]},{"id":"4d179918.41c528","type":"delay","z":"6017ee8f.69be8","name":"5 seconds","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":373.16668701171875,"y":180,"wires":[["a42c92ea.c35b1"]]},{"id":"a42c92ea.c35b1","type":"ftp in","z":"6017ee8f.69be8","ftp":"a73e9c74.ab82","operation":"put","filename":"temperature.txt","localFilename":"/home/dev/temperature.txt","name":"","x":563.1666870117188,"y":178.6666717529297,"wires":[[]]},{"id":"8edb7df4.9811b","type":"pac-device","z":"","address":"10.192.57.38","protocol":"http"},{"id":"a73e9c74.ab82","type":"ftp","z":"","host":"","port":"","secureOptions":"","user":"","connTimeout":"","pasvTimeout":"","keepalive":""}]
1 Like

I’ll play with this. Thanks.