Write to multiple RIO scratchpad using 1 groov i/o write node

Is it possible to write to multiple RIO scratchpad addresses only using 1 groov i/o write node?

I have tried looping around the MMP addresses of the scratchpad so it changes every time the flow injects, but I find it way too slow
any faster I queue up the RIO scratch pad

Need to write atleast a few hundred values into the scratch pad in a very short amount of time

Hi Gabriel, Welcome to the forums!

I took a bit of a look at this and there is nothing obvious jumping out at me, so my off the cuff answer is no.
I’m thinking there should be something more elegant than just blindly looping… I can see how you end up between a rock and and a hard place… But again, I cant think of a better way…

Going to ask around and see what some others suggest.

Bingo!
Spoke with some programmers here and hit paydirt…
Don’t use the groov IO Write node… Use the groov Manage API.

See the PUT at /api/v1/io/{device}/scratchpad/{datatype}/index . The docs say “Writes to one or more scratch pad elements.”

That should do exactly what you are asking

Tip, from groov Manage menu, Click on ‘Info and Help’ → ‘Rest APIs’ → ‘groov Manage’.

Terry has done a great post here that should get you up and running in short order:

1 Like

Thanks for the reply

Will certainly try this

I managed to get the REST API for PAC Control for EPIC working but still having trouble with the groov manage api

Blockquote[{“id”:“92b33a5eb6a076b5”,“type”:“http request”,“z”:“7216bb96f31bdb0a”,“name”:"",“method”:“PUT”,“ret”:“obj”,“paytoqs”:“ignore”,“url”:"",“tls”:“3e36307c3ee7d40b”,“persist”:false,“proxy”:"",“authType”:"",“x”:890,“y”:460,“wires”:[[“d604128c5214fb51”]]},{“id”:“bb94c633fe7aa4e7”,“type”:“function”,“z”:“7216bb96f31bdb0a”,“name”:“set properties”,“func”:“msg.url = “https://localhost/api/v1/io/local/scratchpad/string/index”;\nmsg.headers = {apiKey : “Hm6TLHnrqeqwPcTBumXHxameSGGpqXhr” };\nmsg.payload = {\n “values”: [\n {\n “index”: 0,\n “value”: “string”\n }\n ],\n “encoding”: “ascii”\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“libs”:[],“x”:700,“y”:460,“wires”:[[“92b33a5eb6a076b5”,“d604128c5214fb51”]]},{“id”:“3bd6810eb8ba468f”,“type”:“inject”,“z”:“7216bb96f31bdb0a”,“name”:“inject”,“props”:[{“p”:“payload”},{“p”:“topic”,“vt”:“str”}],“repeat”:"",“crontab”:"",“once”:false,“onceDelay”:0.1,“topic”:"",“payloadType”:“date”,“x”:530,“y”:460,“wires”:[[“bb94c633fe7aa4e7”]]},{“id”:“d604128c5214fb51”,“type”:“debug”,“z”:“7216bb96f31bdb0a”,“name”:"",“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“true”,“targetType”:“full”,“statusVal”:"",“statusType”:“auto”,“x”:1050,“y”:460,“wires”:[]},{“id”:“fb1ee108a575aff8”,“type”:“http request”,“z”:“7216bb96f31bdb0a”,“name”:"",“method”:“GET”,“ret”:“obj”,“paytoqs”:“ignore”,“url”:"",“tls”:“3e36307c3ee7d40b”,“persist”:false,“proxy”:"",“authType”:"",“x”:890,“y”:420,“wires”:[[“6ed91b866ff15760”]]},{“id”:“9a8b605c9277fa4b”,“type”:“function”,“z”:“7216bb96f31bdb0a”,“name”:“set properties”,“func”:“msg.url = “https://localhost/pac/device/strategy/vars/int32s”;\nmsg.headers = { apiKey : “Hm6TLHnrqeqwPcTBumXHxameSGGpqXhr” };\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“libs”:[],“x”:700,“y”:420,“wires”:[[“fb1ee108a575aff8”]]},{“id”:“81996636e667a922”,“type”:“inject”,“z”:“7216bb96f31bdb0a”,“name”:“inject”,“props”:[{“p”:“payload”},{“p”:“topic”,“vt”:“str”}],“repeat”:"",“crontab”:"",“once”:false,“onceDelay”:0.1,“topic”:"",“payloadType”:“date”,“x”:530,“y”:420,“wires”:[[“9a8b605c9277fa4b”]]},{“id”:“6ed91b866ff15760”,“type”:“debug”,“z”:“7216bb96f31bdb0a”,“name”:"",“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“false”,“statusVal”:"",“statusType”:“auto”,“x”:1070,“y”:420,“wires”:[]},{“id”:“3e36307c3ee7d40b”,“type”:“tls-config”,“name”:“localhost”,“cert”:"",“key”:"",“ca”:"",“certname”:"",“keyname”:"",“caname”:"",“servername”:"",“verifyservercert”:false,“alpnprotocol”:""}]

Here’s my flow for it

Error gives me a “JSON parse error”

I used the examples from the Swagger UI still gives me the same error

You have not inserted your example code in the forums correctly, I get an error trying to use it.
Try putting three ``` backticks around it.

oh sorry

[{"id":"92b33a5eb6a076b5","type":"http request","z":"7216bb96f31bdb0a","name":"","method":"PUT","ret":"obj","paytoqs":"ignore","url":"","tls":"3e36307c3ee7d40b","persist":false,"proxy":"","authType":"","x":890,"y":460,"wires":[["d604128c5214fb51"]]},{"id":"bb94c633fe7aa4e7","type":"function","z":"7216bb96f31bdb0a","name":"set properties","func":"msg.url = \"https://localhost/api/v1/io/local/scratchpad/string/index\";\nmsg.headers = {apiKey : \"Hm6TLHnrqeqwPcTBumXHxameSGGpqXhr\" };\nmsg.payload = {\n \"values\": [\n {\n \"index\": 0,\n \"value\": \"string\"\n }\n ],\n \"encoding\": \"ascii\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":700,"y":460,"wires":[["92b33a5eb6a076b5","d604128c5214fb51"]]},{"id":"3bd6810eb8ba468f","type":"inject","z":"7216bb96f31bdb0a","name":"inject","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":530,"y":460,"wires":[["bb94c633fe7aa4e7"]]},{"id":"d604128c5214fb51","type":"debug","z":"7216bb96f31bdb0a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1050,"y":460,"wires":[]},{"id":"fb1ee108a575aff8","type":"http request","z":"7216bb96f31bdb0a","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"3e36307c3ee7d40b","persist":false,"proxy":"","authType":"","x":890,"y":420,"wires":[["6ed91b866ff15760"]]},{"id":"9a8b605c9277fa4b","type":"function","z":"7216bb96f31bdb0a","name":"set properties","func":"msg.url = \"https://localhost/pac/device/strategy/vars/int32s\";\nmsg.headers = { apiKey : \"Hm6TLHnrqeqwPcTBumXHxameSGGpqXhr\" };\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":700,"y":420,"wires":[["fb1ee108a575aff8"]]},{"id":"81996636e667a922","type":"inject","z":"7216bb96f31bdb0a","name":"inject","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":530,"y":420,"wires":[["9a8b605c9277fa4b"]]},{"id":"6ed91b866ff15760","type":"debug","z":"7216bb96f31bdb0a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1070,"y":420,"wires":[]},{"id":"3e36307c3ee7d40b","type":"tls-config","name":"localhost","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false,"alpnprotocol":""}]

Thanks for reposing the code, it was super helpful to find out what you were testing against.

Between Terrys stuff and the tweaks that were made, somehow your Swagger URL was wrong.
Secondly, the call you are making does not return JSON, so hence the error. (Note Terry was doing a PAC control POST and GET were as you are doing a scratchpad one so its different). Change the node to return a string and that error is resolved.

Here is my working flow. Change your API key and you can see your string in the scratchpad after its run.

[{"id":"3bd6810eb8ba468f","type":"inject","z":"ea427df5.3bb83","name":"inject","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":1710,"y":160,"wires":[["bb94c633fe7aa4e7"]]},{"id":"bb94c633fe7aa4e7","type":"function","z":"ea427df5.3bb83","name":"set properties","func":"msg.url = \"https://localhost/manage/api/v1/io/local/scratchpad/string/index\";\nmsg.headers = {apiKey : \"6FVyPucVGfXx5mMzAhd7otPisfYJNNxY\" };\nmsg.payload = {\n \"values\": [\n {\n \"index\": 0,\n \"value\": \"string\"\n }\n ],\n \"encoding\": \"ascii\"\n}\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1880,"y":160,"wires":[["92b33a5eb6a076b5","d604128c5214fb51"]]},{"id":"92b33a5eb6a076b5","type":"http request","z":"ea427df5.3bb83","name":"","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"3e36307c3ee7d40b","persist":false,"proxy":"","authType":"","senderr":false,"x":2070,"y":160,"wires":[["d604128c5214fb51"]]},{"id":"d604128c5214fb51","type":"debug","z":"ea427df5.3bb83","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":2230,"y":160,"wires":[]},{"id":"3e36307c3ee7d40b","type":"tls-config","name":"localhost","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false,"alpnprotocol":""}]

1 Like