Groov Manage API Question

On a previous post about reading a R-1 scratchpad value from Node-RED, @Beno said the following:

I’m investigating this route this morning and using the Swagger API reference as a guide. Unfortunately I’m not able to get any device other than local to work. I have the R-1 defined in the strategy running on my EPIC as pac202, but my request times out when I use that as the device. I suspect that’s because the manage API doesn’t really deal with strategy variables, but thought I’d ask here before giving up.

Any suggestions?

I’m a bit confused by whats happening here - ie, what you are trying to do, so hopefully as you break it down for me, all will become clear…

So the swagger doc is your browser talking to the device that is in your browser URL bar.
There was no swagger doc embed in the R1, so I am assuming you are trying to use swagger from an EPIC/RIO with the API key from the R1 and somehow making calls to the IP address of the R1 (since the R1 can not support host names).
Hope that helps explain how I am confused.

To make API calls to the R1…
https://developer.opto22.com/rest/pac/

Then in Node-RED or PAC Control set up the API keys and make the call to your other IP address.
Be sure and not use https on the R1.
Most of all don’t try and use swagger, the PAC API is different from the swagger EPIC/RIO API.

And do not forget to make the Strategy Variables you want to access public in PAC Control.

1 Like

My hope was to be able to use the Groov manage API in order to read a value from the scratchpad area of an R1 controller on the same network. The R1 controller is defined as an I/O device in the strategy running on the EPIC-PR1 I’m connecting to.

I would love to find a way to make it work, though I’ve worked around the issue for now.

Still confused, but will read between the lines…
groov Manage cant make API calls, its not a client, its a server, you can have, for one example, Node-RED make API calls on groov Manage. You cant use use groov Manage to make API calls on anything.

As I said, the groov Manage API URLs are different from the PAC R1 API, so the commands are different.

Node-RED → EPIC (groov Manage API)
Node-RED → R1 (PAC API)

They are going to be different URL endpoints.

We have customers doing just this:

Let’s know what you want to use to make the SNAP PAC R1 API calls with (Node-RED, Python, PAC Control etc) and we can see if we can help.

But in short, yes, what you are trying to do is pretty easy and a lot of people have built applications around the PAC RESTful API.

As far as I know, there is no REST API for reading values directly from the scratchpad of a R1/S1 generation controller. I’m very familiar with the SNAP PAC API, but my hope was to be able to read values from the scratchpad area of an R1 controller that does not have a strategy running on it (thereby making the SNAP PAC API a moot point).

In my case, I’m using a LCM4 controller to write values to the scratchpad area of an R1 controller. I certainly know that there is no REST API for the LCM4 controller. Also, as far as I know, a LCM4 controller cannot write directly to the scratchpad of an EPIC PR1.

In the post I originally quoted here, here is what you said:

Sort of…

There is no RESTful interface to the scratchpad area on the R1, so Node-RED can not read/write to it directly. What you need to do is set up a chart that reads and writes the required scratchpad area in and out of variables. You then use Node-RED to read and write to those variables.

If you have an EPIC in the mix could you might be able to use the api/v1/io/{device} to specify the R1 device… But I suspect the looping chart moving data in and out of the scratchpad would be the most straight forward way.

It’s that last paragraph that piqued my interest. I was looking for documentation on how to specify a PAC R1 controller as the device for this API endpoint. Perhaps I misunderstood your intent from that quoted thread, but that was my take: that it may be possible to accomplish what I want through the Groov Manage API. If it’s not possible, that’s okay. If it’s possible to write to a Groov EPIC PR-1 scratchpad directly from an LCM4 controller (adding the PR1 as a B3000 SNAP Mixed I/O (SNAP-B3000-ENET like I do for an R1 controller), then this whole discussion would be academic.

I appreciate your help (as always) even when I’m not necessarily explaining myself well.

It is possible to use the OptoMMP protocol in Node-Red, I use it to quickly read a couple IO points on RIOs, as it is faster and uses less CPU than using the REST API. It is a roll your own sort of affair though.

I’ll see if I can dig up a sample for you if you’re interested.

No need. I’ve figured out what I need. I’m not sure why I thought that you couldn’t write to an EPIC scratchpad from an LCM4 controller, but I’ve verified that I can do that, which eliminates my problem.

2 Likes