Node Red - Write file data into Pac write node

I tried to create a backup and restore on groov view using Nodered. I used pac read node to get data from the float table and the write node to write into a USB stick as a txt file. When I tried to read the file and write into pac it shows -

Status code 301. HTTP response error: 301

Can anyone advise me on this? I am new to NodeRed

Hi Naren, welcome to the forums.

Can we break things down a bit to start…
Lets just start with reading the the PAC Control float table for a start.
(Also, lets leave out groov View since I don’t think it has anything to do with what you are trying to do?)

Put an inject node down, then a pac read node and then a debug node.
When you click the inject it will do a read of the float table and the debug will show the data.
Make sure you set the debug node to show the full output, not just msg.payload.
Some screen shots of these three nodes and the debug tab will help us help you.

If we break it down like this then we have a better chance of getting your whole task running bit by bit till we find the error.

Thanks Beno for the reply. I tried debugging found out that I entered ip address for host where I was using local host to get the values. Now I am able to get the values.

I will explain my idea of this node. Currently I need to backup and restore variables, tables in pac control. Something similar to backup and restore on pac display. Currently I am able to get float table from pac control using read pac node and moved to file using write file node as txt file. As I am new to node red and Java script. I don’t know how to get multiple array table from pac control and store them into one single txt file.
For restore I am looking to grab all saved variables from txt file and over write in pac control.
Sorry for the huge explanation. Thanks in advance.

In groov view I am planning to have button called backup and restore which will be tied up to nodered to do function.

Glad you found the IP address typo.

Is there a specific reason you are wanting to put different tables into one text file?
What are you doing to do when you need to go from the one text file back to different tables?
How are you going to know where in the one text file that each table starts and stops?
If you write each table to its own file, it will be a lot easier to restore?

Since you just seem to want to do a backup and restore, have you considered using the optotagpreserve utility?

https://opto22.com/support/resources-tools/downloads/optotagpreserve

I run it from Node-RED every day and before and after a I do a firmware update.
Might that do exactly what you are looking to do?

Currently, I have a project which is climate control. Where it gets input as temperature and humidity. I used pac control to program and groov view as HMI. This climate control has 10 different start times, stop times, and various other set points. Once the user has entered those values. If the user wanted to preserve those data he wanted to backup the file. So I thought of gathering all data from Pac control and storing it as text. If each table has its own file will not the user seem to be overwhelmed by it? As the user is from a university and they do research on this climate control and they do data gathering with different setpoints for temperature and humidity. optotag preserve is something I never heard of. Maybe I think that might help me out in this application. In simple words, i just wanted to store all the tags in the strategy and restore it later.

This optotagpreserve is windows based application right?! What if the user uses only web-based hmi like groov view (Which I am currently working on) Will this optotagperserve work on that or node-red without using a computer? The pac control is only used at the time for uploading the strategy to the epic. Once it is uploaded the epic controller is standalone. Where I made groov screen on epic touch screen. The project I am working on is completely web-based (Only Groov). No Windows application or any computer or pc is installed at the customer’s place.

Sorry, I was under the impression that you had a Windows PC in the mix.

Back to Node-RED and groov View on EPIC then.

One button in groov View (for the operator) for back up and one for restore.
Node-RED will then back up each PAC Control table to a file and restore from each file to each table.

Using the same method as you did to find the issue with the saving (ie, three basic node flow), do the same now for writing.
Then do the same for restoring.
Then finally join the three together as needed with groov View.

(Please keep this thread going vs emailing me - its going to be really helpful for everyone going forward and pretty soon others will chime in with their thoughts).

Yes, of course you can merge all the tables together into one file.
Take a look at the file write node properties, notice one of the options is append to file, so you just tick that and write each table to the same file… BUT…

When the operator wants to restore his settings and clicks the button in groov View to do that, how are you going to program Node-RED to sift through that one big file and find all the table breaks and load just the right number of indexes to each and every table?
That sounds a LOT more work than simply having a file for each table. Easy in and easy out.

Whats your objection to having one button fire off saving each table to its own file?

Having all tables and variables get saved to different files will make the programming lot easier. I have working node till this point. Current I backup all the tables and variables into different files. But as a end user they might have multiple different files. Chances of losing files or files getting corrupt might be higher ?!

One click button saves all the data into file.

Finally was able to create a backup and restore file by storing all tables in json format.
Thanks, Beno for helping me out.

[{"id":"c3dcf24229af0667","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"e37de5e27a13976b","type":"file","z":"c3dcf24229af0667","name":"Backup","filename":"/home/dev/secured/backup.txt","filenameType":"str","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":1060,"y":740,"wires":[[]]},{"id":"08d0e214ecfa8440","type":"pac-read","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"int32-table","tagName":"uiScheduleHumidControl","tableStartIndex":"","tableLength":"","value":"","valueType":"msg.payload","topic":"ScheduleHumidControl","topicType":"user","name":"ScheduleHumidControl","x":570,"y":660,"wires":[["617ff8e95cb4f8b8"]]},{"id":"ab97fb905c405a58","type":"pac-read","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"float-table","tagName":"uiScheduleHumidityDB","tableStartIndex":"","tableLength":"","value":"","valueType":"msg.payload","topic":"ScheduleHumidityDB","topicType":"user","name":"ScheduleHumidityDB","x":560,"y":700,"wires":[["617ff8e95cb4f8b8"]]},{"id":"e7fcf22ab15b8e40","type":"pac-read","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"float-table","tagName":"uiScheduleHumiditySP","tableStartIndex":"","tableLength":"","value":"","valueType":"msg.payload","topic":"ScheduleHumiditySP","topicType":"user","name":"ScheduleHumiditySP","x":560,"y":740,"wires":[["617ff8e95cb4f8b8"]]},{"id":"5c23ea24f9f0c425","type":"pac-read","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"int32-table","tagName":"uiScheduleLightControl","tableStartIndex":"","tableLength":"","value":"","valueType":"msg.payload","topic":"ScheduleLightControl","topicType":"user","name":"ScheduleLightControl","x":560,"y":780,"wires":[["617ff8e95cb4f8b8"]]},{"id":"90e0a66aa615352d","type":"pac-read","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"int32-table","tagName":"uiScheduleLightOnOff","tableStartIndex":"","tableLength":"","value":"","valueType":"msg.payload","topic":"ScheduleLightOnOff","topicType":"user","name":"ScheduleLightOnOff","x":560,"y":820,"wires":[["617ff8e95cb4f8b8"]]},{"id":"313fc1b557b1eb0e","type":"pac-read","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"int32-table","tagName":"uiScheduleTempControl","tableStartIndex":"","tableLength":"","value":"","valueType":"msg.payload","topic":"ScheduleTempControl","topicType":"user","name":"ScheduleTempControl","x":560,"y":860,"wires":[["617ff8e95cb4f8b8"]]},{"id":"9a710da3f4e60f7b","type":"pac-read","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"float-table","tagName":"uiScheduleTempertureSP","tableStartIndex":"","tableLength":"","value":"","valueType":"msg.payload","topic":"ScheduleTempertureSP","topicType":"user","name":"ScheduleTempertureSP","x":570,"y":900,"wires":[["617ff8e95cb4f8b8"]]},{"id":"5b2cac933bef8330","type":"inject","z":"c3dcf24229af0667","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"combine","payloadType":"str","x":240,"y":860,"wires":[["08d0e214ecfa8440","ab97fb905c405a58","e7fcf22ab15b8e40","5c23ea24f9f0c425","90e0a66aa615352d","313fc1b557b1eb0e","9a710da3f4e60f7b","cd8edce43be66323","232a85f6b98aaa6a","296d858cc05de02e","77d3b5971c98952a"]]},{"id":"919252b18b051d1c","type":"delay","z":"c3dcf24229af0667","name":"Delay to Allow All Data","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":940,"y":860,"wires":[["90094118de1e9975"]]},{"id":"90094118de1e9975","type":"function","z":"c3dcf24229af0667","name":"Prepare Data for Writing","func":"// Initialize accumulatedData if it doesn't exist\nif (!flow.get(\"accumulatedData\")) {\n    flow.set(\"accumulatedData\", {});\n}\n\nvar accumulatedData = flow.get(\"accumulatedData\");\nvar topic = msg.topic;\n\n// Store the payload data under the corresponding topic\naccumulatedData[topic] = msg.payload;\n\n// Update the accumulated data in flow context\nflow.set(\"accumulatedData\", accumulatedData);\n\n// Check if all topics have been received\nvar allReceived = true;\nvar allData = Object.keys(accumulatedData);\nvar expectedTopics = [\"ScheduleHumidControl\", \"ScheduleHumidityDB\", \"ScheduleHumiditySP\", \"ScheduleLightControl\", \"ScheduleLightOnOff\", \"ScheduleTempControl\", \"ScheduleTempertureSP\", \"Options\", \"ScheduleFlags\", \"ScheduleStartTime\", \"ScheduleStopTime\"];\n\nfor (var i = 0; i < expectedTopics.length; i++) {\n    if (!allData.includes(expectedTopics[i])) {\n        allReceived = false;\n        break;\n    }\n}\n\n// If all topics have been received, pass the accumulated data to the next node\nif (allReceived) {\n    msg.payload = accumulatedData;\n    flow.set(\"accumulatedData\", null); // Clear accumulated data\n    return msg;\n} else {\n    return null; // Don't send the message until all topics are received\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":990,"y":800,"wires":[["e37de5e27a13976b"]]},{"id":"617ff8e95cb4f8b8","type":"change","z":"c3dcf24229af0667","name":"Accumulate Data","rules":[{"t":"set","p":"accumulatedData","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"accumulatedData[msg.topic]","pt":"msg","to":"payload[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":920,"wires":[["919252b18b051d1c"]]},{"id":"cd8edce43be66323","type":"pac-read","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"float-table","tagName":"uiOptions","tableStartIndex":"","tableLength":"","value":"","valueType":"msg.payload","topic":"Options","topicType":"user","name":"Options ","x":520,"y":940,"wires":[["617ff8e95cb4f8b8"]]},{"id":"232a85f6b98aaa6a","type":"pac-read","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"int32-table","tagName":"uiScheduleFlags","tableStartIndex":"","tableLength":"","value":"","valueType":"msg.payload","topic":"ScheduleFlags","topicType":"user","name":"ScheduleFlags","x":540,"y":980,"wires":[["617ff8e95cb4f8b8"]]},{"id":"296d858cc05de02e","type":"pac-read","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"float-table","tagName":"uiScheduleStartTime","tableStartIndex":"","tableLength":"","value":"","valueType":"msg.payload","topic":"ScheduleStartTime","topicType":"user","name":"ScheduleStartTime","x":550,"y":1020,"wires":[["617ff8e95cb4f8b8"]]},{"id":"77d3b5971c98952a","type":"pac-read","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"float-table","tagName":"uiScheduleStopTime","tableStartIndex":"","tableLength":"","value":"","valueType":"msg.payload","topic":"ScheduleStopTime","topicType":"user","name":"ScheduleStopTime","x":550,"y":1060,"wires":[["617ff8e95cb4f8b8"]]},{"id":"a1c8ad818a8b6fa4","type":"split","z":"c3dcf24229af0667","name":"Split Lines","splt":"\\n","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":true,"addname":"topic","x":470,"y":1400,"wires":[["1c74eb84d6abda81"]]},{"id":"b9d59eb3d4acb4ee","type":"json","z":"c3dcf24229af0667","name":"Parse JSON","property":"payload","action":"","pretty":false,"x":350,"y":1340,"wires":[["a1c8ad818a8b6fa4"]]},{"id":"1c74eb84d6abda81","type":"switch","z":"c3dcf24229af0667","name":"Route Data","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"ScheduleHumidControl","vt":"str"},{"t":"eq","v":"ScheduleHumidityDB","vt":"str"},{"t":"eq","v":"ScheduleHumiditySP","vt":"str"},{"t":"eq","v":"ScheduleLightControl","vt":"str"},{"t":"eq","v":"ScheduleLightOnOff","vt":"str"},{"t":"eq","v":"ScheduleTempControl","vt":"str"},{"t":"eq","v":"ScheduleTempertureSP","vt":"str"},{"t":"eq","v":"Options","vt":"str"},{"t":"eq","v":"ScheduleFlags","vt":"str"},{"t":"eq","v":"ScheduleStartTime","vt":"str"},{"t":"eq","v":"ScheduleStopTime","vt":"str"}],"checkall":"true","repair":false,"outputs":11,"x":670,"y":1400,"wires":[["b9fa313578127ffd"],["1ddbdf4c2453f676"],["508c42cdbc186aa2"],["7d6f0f4b17f76d17"],["7b458ef6d7acd472"],["cb71c33204f48076"],["7e11c6f0defe1b71"],["bf9307d79af95f20"],["81687b3ca9da481d"],["3abddcb5a133bf0d"],["382a25d125933465"]]},{"id":"b9fa313578127ffd","type":"pac-write","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"int32-table","tagName":"uiScheduleHumidControl","tableStartIndex":"","value":"","valueType":"msg.payload","name":"ScheduleHumidControl","x":1030,"y":1160,"wires":[[]]},{"id":"1ddbdf4c2453f676","type":"pac-write","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"float-table","tagName":"uiScheduleHumidityDB","tableStartIndex":"","value":"","valueType":"msg.payload","name":"ScheduleHumidityDB","x":1020,"y":1220,"wires":[[]]},{"id":"508c42cdbc186aa2","type":"pac-write","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"float-table","tagName":"uiScheduleHumiditySP","tableStartIndex":"","value":"","valueType":"msg.payload","name":"ScheduleHumiditySP","x":1020,"y":1280,"wires":[[]]},{"id":"7d6f0f4b17f76d17","type":"pac-write","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"int32-table","tagName":"uiScheduleLightControl","tableStartIndex":"","value":"","valueType":"msg.payload","name":"ScheduleLightControl","x":1020,"y":1340,"wires":[[]]},{"id":"7b458ef6d7acd472","type":"pac-write","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"int32-table","tagName":"uiScheduleLightOnOff","tableStartIndex":"","value":"","valueType":"msg.payload","name":"ScheduleLightOnOff","x":1021,"y":1400,"wires":[[]]},{"id":"cb71c33204f48076","type":"pac-write","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"int32-table","tagName":"uiScheduleTempControl","tableStartIndex":"","value":"","valueType":"msg.payload","name":"ScheduleTempControl","x":1020,"y":1460,"wires":[[]]},{"id":"7e11c6f0defe1b71","type":"pac-write","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"float-table","tagName":"uiScheduleTempertureSP","tableStartIndex":"","value":"","valueType":"msg.payload","name":"ScheduleTempertureSP","x":1030,"y":1520,"wires":[[]]},{"id":"7b9674205a2c4bfb","type":"inject","z":"c3dcf24229af0667","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"combine","payloadType":"str","x":240,"y":1180,"wires":[["9ebda30bdd8fcf4f"]]},{"id":"9ebda30bdd8fcf4f","type":"file in","z":"c3dcf24229af0667","name":"","filename":"/home/dev/secured/backup.txt","filenameType":"str","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":350,"y":1260,"wires":[["b9d59eb3d4acb4ee"]]},{"id":"bf9307d79af95f20","type":"pac-write","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"float-table","tagName":"uiOptions","tableStartIndex":"","value":"","valueType":"msg.payload","name":"Options","x":980,"y":1580,"wires":[[]]},{"id":"81687b3ca9da481d","type":"pac-write","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"int32-table","tagName":"uiScheduleFlags","tableStartIndex":"","value":"","valueType":"msg.payload","name":"ScheduleFlags","x":1000,"y":1640,"wires":[[]]},{"id":"3abddcb5a133bf0d","type":"pac-write","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"float-table","tagName":"uiScheduleStartTime","tableStartIndex":"","value":"","valueType":"msg.payload","name":"ScheduleStartTime","x":1010,"y":1700,"wires":[[]]},{"id":"382a25d125933465","type":"pac-write","z":"c3dcf24229af0667","device":"e2305c3c5ec2d815","dataType":"float-table","tagName":"uiScheduleStopTime","tableStartIndex":"","value":"","valueType":"msg.payload","name":"ScheduleStopTime","x":1010,"y":1760,"wires":[[]]},{"id":"d53ba4d6611fd02d","type":"comment","z":"c3dcf24229af0667","name":"Backup the variables","info":"","x":250,"y":800,"wires":[]},{"id":"8de59836c5e6f0ad","type":"comment","z":"c3dcf24229af0667","name":"Restore the variables","info":"","x":260,"y":1120,"wires":[]},{"id":"e2305c3c5ec2d815","type":"pac-device","address":"localhost","protocol":"https","msgQueueFullBehavior":"DROP_OLD"}]

Keep in mind that as your users change the table data, this flow will break in different (and fun) ways.
Also you wont need that delay node if you switch the construction from parallel as you have, to serial like this:

Its never (ever) a good idea to do parallel reads like that with Node-RED as it places a really large sudden load on the controller as it tries to do all those RESTful calls to the controller to get the data.
As the data changes, the RESTful response will change.

This post will help you with a whole bunch of resources:

Note the one comment toward the bottom that exactly replicates your setup…I have found in the past that if you fetch ‘all at once’ (triggering several PAC Read nodes at once), especially when reading tables, you can get connection errors. Daisy chaining from a single Inject node, as Beno shows in his example flow, overcame this problem.

Saving each PAC table into its own file would be another way around this issue.
Don’t forget you can use the time function to create a time stamp directory so the user knows exactly his latest data.

(Simply use your file write node vs the email one).

So, bottom line, you are very close to having things break, before you deploy into production, you really should rearrange it from parallel to serial so you don’t get any surprises down the road.

1 Like

Yes I got it. Before adding the function I was facing the queuing error on some of the pac read nodes. Will convert this parallel construction to series.

I’m back to this thread after a year. I completed my Opto22 Premium Training last week, and I must admit, I’m a little embarrassed to look at my earlier Node-RED example—it’s a perfect example of how not to use it! :sweat_smile:

In this post, I’m sharing my updated Node-RED flow, which takes data from PAC Control and transfers it to an MSSQL database. I’ve also attached the Node-RED code for anyone who might find it useful for a similar project.

To explain the flow: I use a trigger variable from PAC Control that retrieves all the necessary data, which I then save into a local database on my PC. The setup helps me automate the process of pulling and storing this data seamlessly.

Feel free to take the code, tweak it, and improve upon it for your own use cases. Also, a big thank you to @Beno and @torchard for clearing up all my doubts during the factory training—your guidance was invaluable!

[{"id":"f704e565.cd5f6","type":"tab","label":"SQL Database","disabled":false,"info":""},{"id":"52a4658172968669","type":"inject","z":"f704e565.cd5f6","name":"","props":[],"repeat":"1","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":210,"y":280,"wires":[[]]},{"id":"3abc83ef34f73f36","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"string-variable","tagName":"uoLogStartTime","tableStartIndex":"","tableLength":"","value":"startTime","valueType":"msg","topic":"","topicType":"none","name":"Start Time","x":770,"y":200,"wires":[["e215d52dd55eeca5"]]},{"id":"81e088be22055ee8","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"string-variable","tagName":"uoLogProgram","tableStartIndex":"","tableLength":"","value":"programName","valueType":"msg","topic":"","topicType":"none","name":"Program Name","x":1220,"y":200,"wires":[["688c8d428ad495a5"]]},{"id":"4e8a80bf8b250a2e","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"string-variable","tagName":"uoLogGroup","tableStartIndex":"","tableLength":"","value":"groupName","valueType":"msg","topic":"","topicType":"none","name":"Valve Group Name","x":650,"y":260,"wires":[["fd814c44f788577b"]]},{"id":"fd814c44f788577b","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"int32-variable","tagName":"uoLogTimeZone","tableStartIndex":"","tableLength":"","value":"scheduleNumber","valueType":"msg","topic":"","topicType":"none","name":"Schedule Number","x":850,"y":260,"wires":[["29097393ed528ca2"]]},{"id":"29097393ed528ca2","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"string-variable","tagName":"uoLogValves","tableStartIndex":"","tableLength":"","value":"valveNumber","valueType":"msg","topic":"","topicType":"none","name":"Valve Number","x":1040,"y":260,"wires":[["c3792717c3f68d62"]]},{"id":"c3792717c3f68d62","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"string-variable","tagName":"uoLogEvent","tableStartIndex":"","tableLength":"","value":"eventName","valueType":"msg","topic":"","topicType":"none","name":"Event Name","x":1210,"y":260,"wires":[["bc9816a66ab7afb8"]]},{"id":"bc9816a66ab7afb8","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"string-variable","tagName":"uoLogTrigger","tableStartIndex":"","tableLength":"","value":"triggerType","valueType":"msg","topic":"","topicType":"none","name":"Trigger Type","x":1370,"y":260,"wires":[["fae081c766cf1a0a"]]},{"id":"08589794e47fe894","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-variable","tagName":"uoLogLiters","tableStartIndex":"","tableLength":"","value":"waterUsed","valueType":"msg","topic":"","topicType":"none","name":"Water Used","x":1710,"y":260,"wires":[["bd531937a3d84892"]]},{"id":"688c8d428ad495a5","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"string-variable","tagName":"uoLogRecipeName","tableStartIndex":"","tableLength":"","value":"recipeName","valueType":"msg","topic":"","topicType":"none","name":"Recipe Name","x":1400,"y":200,"wires":[["4e8a80bf8b250a2e"]]},{"id":"92d13d4eb9615111","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"string-variable","tagName":"uoLogStopTime","tableStartIndex":"","tableLength":"","value":"stopTime","valueType":"msg","topic":"","topicType":"none","name":"End Time","x":1060,"y":200,"wires":[["81e088be22055ee8"]]},{"id":"bd531937a3d84892","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-table","tagName":"uoLogInjectorStroke","tableStartIndex":"0","tableLength":"1","value":"injectorStroke1","valueType":"msg","topic":"","topicType":"none","name":"Inj #1 Stroke","x":630,"y":320,"wires":[["920f9066f4f361be"]]},{"id":"920f9066f4f361be","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-table","tagName":"uoLogInjectorStroke","tableStartIndex":"1","tableLength":"1","value":"injectorStroke2","valueType":"msg","topic":"","topicType":"none","name":"Inj #2 Stroke","x":790,"y":320,"wires":[["5d3159d34a1f2784"]]},{"id":"5d3159d34a1f2784","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-table","tagName":"uoLogInjectorStroke","tableStartIndex":"2","tableLength":"1","value":"injectorStroke3","valueType":"msg","topic":"","topicType":"none","name":"Inj #3 Stroke","x":950,"y":320,"wires":[["be46cdf5121e0ce6"]]},{"id":"be46cdf5121e0ce6","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-table","tagName":"uoLogInjectorStroke","tableStartIndex":"3","tableLength":"1","value":"injectorStroke4","valueType":"msg","topic":"","topicType":"none","name":"Inj #4 Stroke","x":1110,"y":320,"wires":[["3909f4b3c4a4a7cf"]]},{"id":"3909f4b3c4a4a7cf","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-table","tagName":"uoLogInjectorStroke","tableStartIndex":"4","tableLength":"1","value":"injectorStroke5","valueType":"msg","topic":"","topicType":"none","name":"Inj #5 Stroke","x":1270,"y":320,"wires":[["15e1f1f4228a25f0"]]},{"id":"15e1f1f4228a25f0","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-table","tagName":"uoLogInjectorStroke","tableStartIndex":"5","tableLength":"1","value":"injectorStroke6","valueType":"msg","topic":"","topicType":"none","name":"Inj #6 Stroke","x":1430,"y":320,"wires":[["34662d680988ba6d"]]},{"id":"34662d680988ba6d","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-table","tagName":"uoLogInjectorStroke","tableStartIndex":"6","tableLength":"1","value":"injectorStroke7","valueType":"msg","topic":"","topicType":"none","name":"Inj #7 Stroke","x":630,"y":380,"wires":[["22267acbf98a1324"]]},{"id":"22267acbf98a1324","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-table","tagName":"uoLogInjectorStroke","tableStartIndex":"7","tableLength":"1","value":"injectorStroke8","valueType":"msg","topic":"","topicType":"none","name":"Inj #8 Stroke","x":790,"y":380,"wires":[["b0b21728ab78c52e"]]},{"id":"b0b21728ab78c52e","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-table","tagName":"uoLogInjectorStroke","tableStartIndex":"8","tableLength":"1","value":"injectorStroke9","valueType":"msg","topic":"","topicType":"none","name":"Inj #9 Stroke","x":950,"y":380,"wires":[["0c2beee45a15e919"]]},{"id":"0c2beee45a15e919","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-table","tagName":"uoLogInjectorStroke","tableStartIndex":"9","tableLength":"1","value":"injectorStroke10","valueType":"msg","topic":"","topicType":"none","name":"Inj #10 Stroke","x":1120,"y":380,"wires":[["2d29ec2d1c4fdcf5"]]},{"id":"2d29ec2d1c4fdcf5","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-table","tagName":"uoLogInjectorStroke","tableStartIndex":"10","tableLength":"1","value":"injectorStroke11","valueType":"msg","topic":"","topicType":"none","name":"Inj #11 Stroke","x":1300,"y":380,"wires":[["188220ca257411ec"]]},{"id":"188220ca257411ec","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-table","tagName":"uoLogInjectorStroke","tableStartIndex":"11","tableLength":"1","value":"injectorStroke12","valueType":"msg","topic":"","topicType":"none","name":"Inj #12 Stroke","x":1480,"y":380,"wires":[["fd80d0835f68d73f"]]},{"id":"53318f297862d588","type":"MSSQL","z":"f704e565.cd5f6","mssqlCN":"349d7e7b6a84c1bd","name":"","query":"-- Check if the Fertigation Manager database exists, and create it if not\nIF NOT EXISTS (SELECT * FROM sys.databases WHERE name = 'FertigationManager')\nBEGIN\n    CREATE DATABASE FertigationManager;\nEND;\n\n-- Use the Fertigation Manager database\nUSE FertigationManager;\n\n-- Check if the Chamber_1 table exists, and create it if not\nIF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'IrrigationLog')\nBEGIN\n    CREATE TABLE IrrigationLog (\n        ID INT IDENTITY(1,1) PRIMARY KEY,\n        DateTimeStamp DATETIME,\n        [Start Date] VARCHAR(MAX),\n        [Start Time] VARCHAR(MAX),\n        [End Date] VARCHAR(MAX),\n        [End Time] VARCHAR(MAX),\n        [Program Name] VARCHAR(MAX),\n        [Recipe Name] VARCHAR(MAX),\n        [Valve Group Name] VARCHAR(MAX),\n        [Schedule Number] INT,\n        [Valve Number] VARCHAR(MAX),\n        [Event Name] VARCHAR(MAX),\n        [Trigger Type] VARCHAR(MAX),\n        [Irrigation Mode] VARCHAR(MAX),\n        [Water Used] FLOAT,\n        [Injector 1 Volume] FLOAT,\n        [Injector 2 Volume] FLOAT,\n        [Injector 3 Volume] FLOAT,\n        [Injector 4 Volume] FLOAT,\n        [Injector 5 Volume] FLOAT,\n        [Injector 6 Volume] FLOAT,\n        [Injector 7 Volume] FLOAT,\n        [Injector 8 Volume] FLOAT,\n        [Injector 9 Volume] FLOAT,\n        [Injector 10 Volume] FLOAT,\n        [Injector 11 Volume] FLOAT,\n        [Injector 12 Volume] FLOAT,\n        [Injector 1 pulse count] INT,\n        [Injector 2 pulse count] INT,\n        [Injector 3 pulse count] INT,\n        [Injector 4 pulse count] INT,\n        [Injector 5 pulse count] INT,\n        [Injector 6 pulse count] INT,\n        [Injector 7 pulse count] INT,\n        [Injector 8 pulse count] INT,\n        [Injector 9 pulse count] INT,\n        [Injector 10 pulse count] INT,\n        [Injector 11 pulse count] INT,\n        [Injector 12 pulse count] INT       \n    );\nEND;\n\n--Declare variables\nDECLARE @storeStartDate VARCHAR(MAX)\nDECLARE @storeStartTime VARCHAR(MAX)\nDECLARE @storeStopDate VARCHAR(MAX)\nDECLARE @storeStopTime VARCHAR(MAX)\nDECLARE @storeProgramName VARCHAR(MAX)\nDECLARE @storeRecipeName VARCHAR(MAX)\nDECLARE @storeValveGroupName VARCHAR(MAX)\nDECLARE @storeSchedulerNumber INT\nDECLARE @storeValveNumber VARCHAR(MAX)\nDECLARE @storeEventName VARCHAR(MAX)\nDECLARE @storeTriggerType VARCHAR(MAX)\nDECLARE @storeIrrigationMode VARCHAR(MAX)\nDECLARE @storeWaterUsed FLOAT\n\nDECLARE @storeInjector1Stroke FLOAT\nDECLARE @storeInjector2Stroke FLOAT\nDECLARE @storeInjector3Stroke FLOAT\nDECLARE @storeInjector4Stroke FLOAT\nDECLARE @storeInjector5Stroke FLOAT\nDECLARE @storeInjector6Stroke FLOAT\nDECLARE @storeInjector7Stroke FLOAT\nDECLARE @storeInjector8Stroke FLOAT\nDECLARE @storeInjector9Stroke FLOAT\nDECLARE @storeInjector10Stroke FLOAT\nDECLARE @storeInjector11Stroke FLOAT\nDECLARE @storeInjector12Stroke FLOAT\n\nDECLARE @storeInjector1Pulse INT\nDECLARE @storeInjector2Pulse INT\nDECLARE @storeInjector3Pulse INT\nDECLARE @storeInjector4Pulse INT\nDECLARE @storeInjector5Pulse INT\nDECLARE @storeInjector6Pulse INT\nDECLARE @storeInjector7Pulse INT\nDECLARE @storeInjector8Pulse INT\nDECLARE @storeInjector9Pulse INT\nDECLARE @storeInjector10Pulse INT\nDECLARE @storeInjector11Pulse INT\nDECLARE @storeInjector12Pulse INT\n\n--Set the values\nSET @storeStartDate = '{{{startDate}}}';\nSET @storeStartTime = '{{{startTime}}}';\nSET @storeStopDate = '{{{stopDate}}}';\nSET @storeStopTime = '{{{stopTime}}}';\nSET @storeProgramName = '{{{programName}}}';\nSET @storeRecipeName = '{{{recipeName}}}';\nSET @storeValveGroupName = '{{{groupName}}}';\nSET @storeSchedulerNumber = {{{scheduleNumber}}};\nSET @storeValveNumber = {{{valveNumber}}};\nSET @storeEventName = '{{{eventName}}}';\nSET @storeTriggerType = '{{{triggerType}}}';\nSET @storeIrrigationMode = '{{{irrigationMode}}}';\nSET @storeWaterUsed = {{{waterUsed}}};\n\nSET @storeInjector1Stroke = {{{injectorStroke1}}};\nSET @storeInjector2Stroke = {{{injectorStroke2}}};\nSET @storeInjector3Stroke = {{{injectorStroke3}}};\nSET @storeInjector4Stroke = {{{injectorStroke4}}};\nSET @storeInjector5Stroke = {{{injectorStroke5}}};\nSET @storeInjector6Stroke = {{{injectorStroke6}}};\nSET @storeInjector7Stroke = {{{injectorStroke7}}};\nSET @storeInjector8Stroke = {{{injectorStroke8}}};\nSET @storeInjector9Stroke = {{{injectorStroke9}}};\nSET @storeInjector10Stroke = {{{injectorStroke10}}};\nSET @storeInjector11Stroke = {{{injectorStroke11}}};\nSET @storeInjector12Stroke = {{{injectorStroke12}}};\n\nSET @storeInjector1Pulse = {{{injectorPulse1}}};\nSET @storeInjector2Pulse = {{{injectorPulse2}}};\nSET @storeInjector3Pulse = {{{injectorPulse3}}};\nSET @storeInjector4Pulse = {{{injectorPulse4}}};\nSET @storeInjector5Pulse = {{{injectorPulse5}}};\nSET @storeInjector6Pulse = {{{injectorPulse6}}};\nSET @storeInjector7Pulse = {{{injectorPulse7}}};\nSET @storeInjector8Pulse = {{{injectorPulse8}}};\nSET @storeInjector9Pulse = {{{injectorPulse9}}};\nSET @storeInjector10Pulse = {{{injectorPulse10}}};\nSET @storeInjector11Pulse = {{{injectorPulse11}}};\nSET @storeInjector12Pulse = {{{injectorPulse12}}};\n\n-- Insert data into the IrrigationLog table\nINSERT INTO IrrigationLog (\n    DateTimeStamp,\n    [Start Date],\n    [Start Time],\n    [End Date],\n    [End Time],\n    [Program Name],\n    [Recipe Name],\n    [Valve Group Name],\n    [Schedule Number],\n    [Valve Number],\n    [Event Name],\n    [Trigger Type],\n    [Irrigation Mode],\n    [Water Used],\n    [Injector 1 Volume],\n    [Injector 2 Volume],\n    [Injector 3 Volume],\n    [Injector 4 Volume],\n    [Injector 5 Volume],\n    [Injector 6 Volume],\n    [Injector 7 Volume],\n    [Injector 8 Volume],\n    [Injector 9 Volume],\n    [Injector 10 Volume],\n    [Injector 11 Volume],\n    [Injector 12 Volume],\n    [Injector 1 pulse count],\n    [Injector 2 pulse count],\n    [Injector 3 pulse count],\n    [Injector 4 pulse count],\n    [Injector 5 pulse count],\n    [Injector 6 pulse count],\n    [Injector 7 pulse count],\n    [Injector 8 pulse count],\n    [Injector 9 pulse count],\n    [Injector 10 pulse count],\n    [Injector 11 pulse count],\n    [Injector 12 pulse count]    \n)\nVALUES (\n    GETDATE(),\n    @storeStartDate,\n    @storeStartTime,\n    @storeStopDate,\n    @storeStopTime,\n    @storeProgramName,\n    @storeRecipeName,\n    @storeValveGroupName,\n    @storeSchedulerNumber,\n    @storeValveNumber,\n    @storeEventName,\n    @storeTriggerType,\n    @storeIrrigationMode,\n    @storeWaterUsed,\n    @storeInjector1Stroke, \n    @storeInjector2Stroke,\n    @storeInjector3Stroke,\n    @storeInjector4Stroke, \n    @storeInjector5Stroke, \n    @storeInjector6Stroke, \n    @storeInjector7Stroke, \n    @storeInjector8Stroke, \n    @storeInjector9Stroke, \n    @storeInjector10Stroke, \n    @storeInjector11Stroke, \n    @storeInjector12Stroke, \n    @storeInjector1Pulse,\n    @storeInjector2Pulse,\n    @storeInjector3Pulse,\n    @storeInjector4Pulse,\n    @storeInjector5Pulse,\n    @storeInjector6Pulse,\n    @storeInjector7Pulse,\n    @storeInjector8Pulse, \n    @storeInjector9Pulse,\n    @storeInjector10Pulse,\n    @storeInjector11Pulse,\n    @storeInjector12Pulse\n);\n","outField":"payload","x":1580,"y":500,"wires":[["5ffb0cb7e81a7eef"]]},{"id":"49dd113bd95427a3","type":"switch","z":"f704e565.cd5f6","name":"","property":"LogStart","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":200,"wires":[["751f74373972e96a"]]},{"id":"b3d1c5c515be4e5a","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"int32-variable","tagName":"uoLogStart","tableStartIndex":"","tableLength":"","value":"LogStart","valueType":"msg","topic":"","topicType":"none","name":"","x":350,"y":280,"wires":[["49dd113bd95427a3"]]},{"id":"5ffb0cb7e81a7eef","type":"debug","z":"f704e565.cd5f6","name":"debug 2","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"timestamp","targetType":"msg","statusVal":"","statusType":"auto","x":1720,"y":500,"wires":[]},{"id":"751f74373972e96a","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"string-variable","tagName":"uoLogStartDate","tableStartIndex":"","tableLength":"","value":"startDate","valueType":"msg","topic":"","topicType":"none","name":"Start Date","x":620,"y":200,"wires":[["3abc83ef34f73f36"]]},{"id":"e215d52dd55eeca5","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"string-variable","tagName":"uoLogStopDate","tableStartIndex":"","tableLength":"","value":"stopDate","valueType":"msg","topic":"","topicType":"none","name":"End Date","x":920,"y":200,"wires":[["92d13d4eb9615111"]]},{"id":"fae081c766cf1a0a","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"string-variable","tagName":"uoLogIrrigationMode","tableStartIndex":"","tableLength":"","value":"irrigationMode","valueType":"msg","topic":"","topicType":"none","name":"Irrigation Mode","x":1540,"y":260,"wires":[["08589794e47fe894"]]},{"id":"fd80d0835f68d73f","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"int32-table","tagName":"uoLogInjectorPulseCount","tableStartIndex":"0","tableLength":"1","value":"injectorPulse1","valueType":"msg","topic":"","topicType":"none","name":"Inj #1 Pulse","x":630,"y":440,"wires":[["fec432c7f88b0cf9"]]},{"id":"fec432c7f88b0cf9","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"int32-table","tagName":"uoLogInjectorPulseCount","tableStartIndex":"1","tableLength":"1","value":"injectorPulse2","valueType":"msg","topic":"","topicType":"none","name":"Inj #2 Pulse","x":790,"y":440,"wires":[["1ad338b40e4c94d4"]]},{"id":"1ad338b40e4c94d4","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"int32-table","tagName":"uoLogInjectorPulseCount","tableStartIndex":"2","tableLength":"1","value":"injectorPulse3","valueType":"msg","topic":"","topicType":"none","name":"Inj #3 Pulse","x":950,"y":440,"wires":[["e89537cb19403243"]]},{"id":"e89537cb19403243","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"int32-table","tagName":"uoLogInjectorPulseCount","tableStartIndex":"3","tableLength":"1","value":"injectorPulse4","valueType":"msg","topic":"","topicType":"none","name":"Inj #4 Pulse","x":1110,"y":440,"wires":[["4b2270c156138047"]]},{"id":"4b2270c156138047","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"int32-table","tagName":"uoLogInjectorPulseCount","tableStartIndex":"4","tableLength":"1","value":"injectorPulse5","valueType":"msg","topic":"","topicType":"none","name":"Inj #5 Pulse","x":1270,"y":440,"wires":[["bb61e7087c31567c"]]},{"id":"bb61e7087c31567c","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"int32-table","tagName":"uoLogInjectorPulseCount","tableStartIndex":"5","tableLength":"1","value":"injectorPulse6","valueType":"msg","topic":"","topicType":"none","name":"Inj #6 Pulse","x":1430,"y":440,"wires":[["4d3e599bb15e9a55"]]},{"id":"4d3e599bb15e9a55","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"int32-table","tagName":"uoLogInjectorPulseCount","tableStartIndex":"6","tableLength":"1","value":"injectorPulse7","valueType":"msg","topic":"","topicType":"none","name":"Inj #7 Pulse","x":630,"y":500,"wires":[["9aa18a0780f5c122"]]},{"id":"9aa18a0780f5c122","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"int32-table","tagName":"uoLogInjectorPulseCount","tableStartIndex":"7","tableLength":"1","value":"injectorPulse8","valueType":"msg","topic":"","topicType":"none","name":"Inj #8 Pulse","x":790,"y":500,"wires":[["34b811e0cba87150"]]},{"id":"34b811e0cba87150","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"int32-table","tagName":"uoLogInjectorPulseCount","tableStartIndex":"8","tableLength":"1","value":"injectorPulse9","valueType":"msg","topic":"","topicType":"none","name":"Inj #9 Pulse","x":950,"y":500,"wires":[["ec6d0643a76bee0b"]]},{"id":"ec6d0643a76bee0b","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"int32-table","tagName":"uoLogInjectorPulseCount","tableStartIndex":"9","tableLength":"1","value":"injectorPulse10","valueType":"msg","topic":"","topicType":"none","name":"Inj #10 Pulse","x":1110,"y":500,"wires":[["8458744ae2feef2a"]]},{"id":"8458744ae2feef2a","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"int32-table","tagName":"uoLogInjectorPulseCount","tableStartIndex":"10","tableLength":"1","value":"injectorPulse11","valueType":"msg","topic":"","topicType":"none","name":"Inj #11 Pulse","x":1270,"y":500,"wires":[["9f9b1c84b57f0080"]]},{"id":"9f9b1c84b57f0080","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"int32-table","tagName":"uoLogInjectorPulseCount","tableStartIndex":"11","tableLength":"1","value":"injectorPulse12","valueType":"msg","topic":"","topicType":"none","name":"Inj #12 Pulse","x":1430,"y":500,"wires":[["53318f297862d588"]]},{"id":"09f9f263024e1384","type":"inject","z":"f704e565.cd5f6","name":"","props":[],"repeat":"10","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":210,"y":740,"wires":[[]]},{"id":"43bf4af643141c51","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-variable","tagName":"fFlowRate","tableStartIndex":"","tableLength":"","value":"Flowrate","valueType":"msg","topic":"","topicType":"none","name":"Flow Rate","x":340,"y":740,"wires":[["073457424a29b839"]]},{"id":"ac165f144df66bc2","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-variable","tagName":"fCurrentEC","tableStartIndex":"","tableLength":"","value":"ECOut","valueType":"msg","topic":"","topicType":"none","name":"EC out","x":1310,"y":740,"wires":[["0fbd23506da716d1"]]},{"id":"dc5bbc9c969237a6","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-variable","tagName":"fAuxPH","tableStartIndex":"","tableLength":"","value":"PHIn","valueType":"msg","topic":"","topicType":"none","name":"pH In","x":950,"y":740,"wires":[["04238e3043e461a4"]]},{"id":"073457424a29b839","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-variable","tagName":"fCurrentTEMP","tableStartIndex":"","tableLength":"","value":"Temperature","valueType":"msg","topic":"","topicType":"none","name":"Temperature","x":490,"y":740,"wires":[["4f1dd184c7bef72b"]]},{"id":"aaae2a5b94258471","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-variable","tagName":"fAuxEC","tableStartIndex":"","tableLength":"","value":"ECIn","valueType":"msg","topic":"","topicType":"none","name":"EC In","x":1190,"y":740,"wires":[["ac165f144df66bc2"]]},{"id":"4f1dd184c7bef72b","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-variable","tagName":"fCurrentPRESSURE_Int","tableStartIndex":"","tableLength":"","value":"PressureInt","valueType":"msg","topic":"","topicType":"none","name":"Pressure Int","x":650,"y":740,"wires":[["834b2e37f6412604"]]},{"id":"0fbd23506da716d1","type":"MSSQL","z":"f704e565.cd5f6","mssqlCN":"349d7e7b6a84c1bd","name":"","query":"-- Check if the Fertigation Manager database exists, and create it if not\nIF NOT EXISTS (SELECT * FROM sys.databases WHERE name = 'FertigationManager')\nBEGIN\n    CREATE DATABASE FertigationManager;\nEND;\n\n-- Use the Fertigation Manager database\nUSE FertigationManager;\n\n-- Check if the SensorReading table exists, and create it if not\nIF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'SensorReading')\nBEGIN\n    CREATE TABLE SensorReading (\n        ID INT IDENTITY(1,1) PRIMARY KEY,\n        DateTimeStamp DATETIME,\n        [Flow Rate] FLOAT,\n        Temperature FLOAT,\n        [Pressure Int] FLOAT,\n        [Pressure Ext] FLOAT,\n        [pH In] FLOAT,\n        [pH Out] FLOAT,\n        [EC In] FLOAT,\n        [EC Out] FLOAT           \n    );\nEND;\n\n-- Insert data into the SensorReading table\nINSERT INTO SensorReading (\n    DateTimeStamp,\n    [Flow Rate],\n    Temperature,\n    [Pressure Int],\n    [Pressure Ext],\n    [pH In],\n    [pH Out],\n    [EC In],\n    [EC Out]\n)\nVALUES (\n    GETDATE(),\n    {{Flowrate}},\n    {{Temperature}},\n    {{PressureInt}},\n    {{PressureExt}},\n    {{PHIn}},\n    {{PHOut}},\n    {{ECIn}},\n    {{ECOut}}\n);\n","outField":"payload","x":1440,"y":740,"wires":[["443c6229f6288446"]]},{"id":"443c6229f6288446","type":"debug","z":"f704e565.cd5f6","name":"debug 1","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1580,"y":740,"wires":[]},{"id":"834b2e37f6412604","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-variable","tagName":"fCurrentPRESSURE_Ext","tableStartIndex":"","tableLength":"","value":"PressureExt","valueType":"msg","topic":"","topicType":"none","name":"Pressure Ext","x":810,"y":740,"wires":[["dc5bbc9c969237a6"]]},{"id":"04238e3043e461a4","type":"pac-read","z":"f704e565.cd5f6","device":"4608f02f8d4f60fe","dataType":"float-variable","tagName":"fCurrentPH","tableStartIndex":"","tableLength":"","value":"PHOut","valueType":"msg","topic":"","topicType":"none","name":"pH out","x":1070,"y":740,"wires":[["aaae2a5b94258471"]]},{"id":"4608f02f8d4f60fe","type":"pac-device","address":"localhost","protocol":"https","msgQueueFullBehavior":"DROP_OLD"},{"id":"349d7e7b6a84c1bd","type":"MSSQL-CN","name":"SQL Database","server":"192.168.1.26","encyption":false,"database":""}]

Are you seeing any performance improvements as as result of the restructure?

And thanks a heap for the follow up post, as you know, it makes the thread so much more valuable.

Greatly helped, the sudden spike in the cpu has reduced significantly. Plus, no more error code or loss of data occurred since I changed from parallel to series nodes.

2 Likes