PLC, json get and post

#1

Hey,

I'm new to Node-RED. My goal is to communicate between a webservice and a PLC. I have been succesful in putting data into the PLC. The post will be a bunch of parameters to be stored in the PLC.

Any suggestions on how to go about seperating the values. So that i can send these values to the PLC.

For example:
image

As a plc-programmer I am not that familiar with json code.

Thanks for the help!

0 Likes

#2

That doesn't look like JSON, so how are you getting these values into Node-RED?
If it's as a single text string then theres the javascript split command or you could try the csv node.

There's a handy page in the docs that explains about using the debug panel to identify the right path to items https://nodered.org/docs/user-guide/messages

It would also be worth reading one of the online tutorials on Javascript Objects and Arrays ( eg w3schools) as its fundamental to manipulating data in Node-RED

0 Likes

#3

The code in the string from the JSON get will look like this,

image

0 Likes

#4

and if you send it to the debug panel using a debug node the page I linked to will explain how to get the path to specific items.

But please read an online tutorial about javascript objects and arrays, it’s time well spent.

0 Likes

#5

I will try this out! Thanks for the help

0 Likes

#6

A side question, if I may, what PLC are your using?

0 Likes

#7

Thanks ukmoose for the advice. It has worked.

It has worked with a Siemens 300 and 1500 series.

0 Likes