Hilscher Community Forum
[SOLVED] Help with fieldbus node - Printable Version

+- Hilscher Community Forum (https://forum.hilscher.com)
+-- Forum: netPI 3 - Docker featuring Industrial Raspberry Pi 3 platform (https://forum.hilscher.com/forum-1.html)
+--- Forum: Software (https://forum.hilscher.com/forum-5.html)
+--- Thread: [SOLVED] Help with fieldbus node (/thread-475.html)



[SOLVED] Help with fieldbus node - Farani - August-14th-2019

Hi.

I am trying to receive and send boolean value to my test PLC with the fieldbus node. I was able to rec from the PLC without error. But i was unable to send to the PLC through the fieldbus output node. How can i test this?

Error message : OUT_NODE expects the property 'payload' as an object

Attached are the snapshots.        


RE: Help with fieldbus node - Armin@netPI - August-14th-2019

Hi there,

the fieldbus nodes have a readme info text as any node under node-red has. Just click the node and click the "i" button to read it.

There you will find an example how to hand over data to the fieldbus.

>
msg.payload has to be a JSON object containing the property "value" holding the value(s) to be written to the signal specified
Example:
msg.payload.value = [9,8,7,6] will write a signal of type 'array' with 4 elements
msg.payload.value = 1 will write a discrete signal
msg.payload.value = "true" will also write a discrete signal of type bit
<

I have one remark. We can't see your screen shots. You have specifically press "add attachment" to append a screen shot to a post. Just selecting a file is not enough.

Thx
Armin


RE: Help with fieldbus node - Farani - August-15th-2019

I've updated the screenshots. So in this case, i have to include a change node in between the inject and fieldbus out node?

Btw, i was following the pdf documentation as per snapshot

   


RE: Help with fieldbus node - Armin@netPI - August-15th-2019

Dear Farani,

you found a bug in the documentation. The documentation of the inject node in relation to the fieldbus node is wrong. Thank you for your remark

It is not correct to inject a "number" type value to "msg.payload" like as it is documented today.

Instead you have to use "JSON" type value and then inject a msg.payload value {"value":2} as example.

Look how I did it:

   

What you can of course do is to use a simple inject node that connects to a function node where you write a javascript code like this:

msg.payload = {};
msg.payload.value = 2;

and then connect it to a fieldbus node. Look here:

   

Sorry for this inconvenience. I already wrote the documentation team an email to get it corrected in future in the manual.

Thx
Armin


RE: Help with fieldbus node - Farani - August-16th-2019

(August-15th-2019, 06:32 AM)Armin@netPI Wrote: Dear Farani,

you found a bug in the documentation. The documentation of the inject node in relation to the fieldbus node is wrong. Thank you for your remark

It is not correct to inject a "number" type value to "msg.payload" like as it is documented today.

Instead you have to use "JSON" type value and then inject a msg.payload value {"value":2} as example.

Look how I did it:



What you can of course do is to use a simple inject node that connects to a function node where you write a javascript code like this:

msg.payload = {};
msg.payload.value = 2;

and then connect it to a fieldbus node. Look here:



Sorry for this inconvenience. I already wrote the documentation team an email to get it corrected in future in the manual.

Thx
Armin

Much appreciated. Thank you very much.


RE: [SOLVED] Help with fieldbus node - Armin@netPI - August-20th-2019

By the way for all others who are interested in the common "Fieldbus Node" video for Hilscher's Edge Gateways: 

Here is the link to it https://youtu.be/TmNgbGS_ydE