Datatype error for fieldbus node

#1

Hello,

I am connecting my IoT gateway with PLC to exchange I/O data. One way it works well I can get data from PLC into Node-RED debug window.

But other way, when I try to send data out from Node-RED then it gives me error & I can not read data into PLC?

any idea ? how to solve this error?

BR
Madhumati

#2

The error says it expects msg.payload to be an object. But you are passing it a plain number, 2.

So you’ll need to properly format the message. Unfortunately I cannot find any reference to fieldbus on the flow library so I don’t know what nodes you are using - but I would start by reading their help to see what they say about required message formats.

#3

[{“id”:“a1af795a.b2f908”,“type”:“fieldbus in”,“z”:“8b1bf5df.06ee88”,“name”:“input1”,“FieldbusNodeVersion”:“1.2.7”,“WrapperVersion”:“1.2.7”,“WrapperCompileDate”:“Mar 8 2018/16:37:23”,“MinExpectedNodeJSVersion”:“8.9.4”,“ActNodeJSVersion”:“8.9.4”,“ActNodeREDVersion”:“0.17.5”,“selectedSignalPath”:“input~receive_001~Sig_1”,“fieldbusObj”:“8d60afb2.d17fc”,“x”:203,“y”:123,“wires”:[[“58907f62.3e2f5”,“7a97663c.dca268”]]},{“id”:“58907f62.3e2f5”,“type”:“debug”,“z”:“8b1bf5df.06ee88”,“name”:"",“active”:true,“console”:“false”,“complete”:“false”,“x”:490,“y”:127,“wires”:[]},{“id”:“508531e7.e43bb”,“type”:“fieldbus in”,“z”:“8b1bf5df.06ee88”,“name”:“Input 2”,“FieldbusNodeVersion”:“1.2.7”,“WrapperVersion”:“1.2.7”,“WrapperCompileDate”:“Mar 8 2018/16:37:23”,“MinExpectedNodeJSVersion”:“8.9.4”,“ActNodeJSVersion”:“8.9.4”,“ActNodeREDVersion”:“0.17.5”,“selectedSignalPath”:“input~receive_001~Sig_2”,“fieldbusObj”:“8d60afb2.d17fc”,“x”:201,“y”:189,“wires”:[[“58907f62.3e2f5”]]},{“id”:“45d8dda1.149eb4”,“type”:“inject”,“z”:“8b1bf5df.06ee88”,“name”:"",“topic”:"",“payload”:“2”,“payloadType”:“json”,“repeat”:"",“crontab”:"",“once”:false,“x”:230,“y”:300,“wires”:[[“c9bb84e0.988b58”,“6d8cceee.2f426”]]},{“id”:“c9bb84e0.988b58”,“type”:“fieldbus out”,“z”:“8b1bf5df.06ee88”,“name”:“Output1”,“FieldbusNodeVersion”:“1.2.7”,“WrapperVersion”:“1.2.7”,“WrapperCompileDate”:“Mar 8 2018/16:37:23”,“MinExpectedNodeJSVersion”:“8.9.4”,“ActNodeJSVersion”:“8.9.4”,“ActNodeREDVersion”:“0.17.5”,“selectedSignalPath”:“output~send_001~Sig_1”,“fieldbusObj”:“8d60afb2.d17fc”,“x”:500,“y”:300,“wires”:[]},{“id”:“6d8cceee.2f426”,“type”:“debug”,“z”:“8b1bf5df.06ee88”,“name”:"",“active”:true,“console”:“false”,“complete”:“false”,“x”:482,“y”:371,“wires”:[]},{“id”:“aab75cf5.44044”,“type”:“ui_chart”,“z”:“8b1bf5df.06ee88”,“name”:“Untitled Theme 1”,“group”:“215e324.361b7ce”,“order”:0,“width”:0,“height”:0,“label”:“chart”,“chartType”:“line”,“legend”:“false”,“xformat”:“HH:mm:ss”,“interpolate”:“linear”,“nodata”:"",“dot”:false,“ymin”:“1”,“ymax”:“10”,“removeOlder”:“5”,“removeOlderPoints”:"",“removeOlderUnit”:“60”,“cutout”:0,“useOneColor”:false,“colors”:["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],“useOldStyle”:false,“x”:650,“y”:220,“wires”:[[],[]]},{“id”:“7a97663c.dca268”,“type”:“change”,“z”:“8b1bf5df.06ee88”,“name”:"",“rules”:[{“t”:“set”,“p”:“payload”,“pt”:“msg”,“to”:“msg.payload.Value”,“tot”:“str”}],“action”:"",“property”:"",“from”:"",“to”:"",“reg”:false,“x”:425,“y”:204,“wires”:[[“aab75cf5.44044”]]},{“id”:“8d60afb2.d17fc”,“type”:“fieldbus interface”,“z”:"",“availableStackName”:“PROFINET IO Device (version 3.12, build 0 revision 8): cifX0”,“interfaceComponents”:"{“fwName”:“PROFINET IO Device”,“boardName”:“cifX0”,“fwVersionMajor”:3,“fwVersionMinor”:12,“fwVersionBuild”:0,“fwVersionRev”:8,“prtName”:“PROFINET IO”,“className”:“Device”,“prtClassNumber”:21,“commClassNumber”:10,“channelNumber”:2,“deviceNumber”:1291105,“serialNumber”:21005}",“clearOutputsOnDeploy”:false,“traceFilePath”:"/var/log/node-red/node-fieldbus.log",“traceLevelWrapper”:“wrapper”,“traceLevelNode”:“node”},{“id”:“215e324.361b7ce”,“type”:“ui_group”,“z”:"",“name”:“Test”,“tab”:“622cd1f9.3740f”,“disp”:true,“width”:“6”},{“id”:“622cd1f9.3740f”,“type”:“ui_tab”,“z”:"",“name”:“Home”,“icon”:“dashboard”}]

above is the flow script for reference.

#4

I want to transfer payload as value 3 to output1 node,

#5

So where are you running node-red?

If it is on a computer/server that you installed what is the full name of the fieldbus node you are using?

If sharing code/flows please read the pinned message How to share code or flow json

What format does the node want?

#6

Node-RED in installed on one of my intel device ( edge computing gateway) which is used in industrial automation.
It has ethernet port as Profinet application..that uses Fieldbus Input & Output node.


Fieldbus out node wants payload property as 'object'

#7

-[{"id":"3ed1ad07.8ac8e2","type":"fieldbus out","z":"7f989cb6.e2adb4","name":"output1","FieldbusNodeVersion":"1.2.7","WrapperVersion":"1.2.7","WrapperCompileDate":"Mar 8 2018/16:37:23","MinExpectedNodeJSVersion":"8.9.4","ActNodeJSVersion":"8.9.4","ActNodeREDVersion":"0.17.5","selectedSignalPath":"output~send_001~Sig_1","fieldbusObj":"9cc09ae3.c39708","x":640,"y":400,"wires":[]},{"id":"4783f5a2.ead00c","type":"debug","z":"7f989cb6.e2adb4","name":"","active":true,"console":"false","complete":"payload","x":540,"y":520,"wires":[]},{"id":"157622c7.c1c92d","type":"ui_numeric","z":"7f989cb6.e2adb4","name":"","label":"numeric","group":"a48248f8.914658","order":0,"width":0,"height":0,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":10,"step":1,"x":220,"y":580,"wires":[["4783f5a2.ead00c","8ca17cb0.1e6e7"]]},{"id":"8ca17cb0.1e6e7","type":"change","z":"7f989cb6.e2adb4","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"","fromt":"num","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":400,"wires":[["3ed1ad07.8ac8e2"]]},{"id":"9cc09ae3.c39708","type":"fieldbus interface","z":"","availableStackName":"PROFINET IO Device (version 3.12, build 0 revision 8): cifX0","interfaceComponents":"{\"fwName\":\"PROFINET IO Device\",\"boardName\":\"cifX0\",\"fwVersionMajor\":3,\"fwVersionMinor\":12,\"fwVersionBuild\":0,\"fwVersionRev\":8,\"prtName\":\"PROFINET IO\",\"className\":\"Device\",\"prtClassNumber\":21,\"commClassNumber\":10,\"channelNumber\":2,\"deviceNumber\":1291105,\"serialNumber\":21005}","clearOutputsOnDeploy":false,"traceFilePath":"/var/log/node-red/node-fieldbus.log","traceLevelWrapper":"wrapper","traceLevelNode":"node"},{"id":"a48248f8.914658","type":"ui_group","z":"","name":"Test","tab":"da33b799.9702e8","disp":true,"width":"6"},{"id":"da33b799.9702e8","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]

#8

What module have you installed to get those nodes? As I said a month ago, I can't find any reference to 'fieldbus' in the flow library.

https://flows.nodered.org/?term=field&num_pages=1

#9

Wanting the property as an object doesn’t really help,
have a read of this page to see what I mean https://www.w3schools.com/js/js_object_definition.asp

So if we can identify the node we may be able to work out what the format of the object is.

Did you install the fieldbus node?
Is so where from?
What is it’s name?

#10

Yes. Fieldbus node is special node specific for industrial communication. This is developed by our company for Profinet/ethernet-IP communication

#11

In a previous reply you said:

I want to transfer payload as value 3 to output1 node,

So you need to set msg.payload to some form of object containing the value 3. But as we don't have access to the fieldbus node, we cannot tell you what format that object should take. You need to speak to whoever wrote the node to find out how to use it.

#12

I would like to give more details here about my test -

In below case my field bus output node works fine & dont give any error if I connect fieldbus input 2 node to output 2 as below

But the same if I give as dashboard input numeric value, fieldbus output node does not work, Below screenshot -


please let me know if you can support ..

#13

In the second case, it looks like your payload already contains the number 2, right?
So why would you need the change node? If the payload is a number, then msg.payload.value would not exist...

#14

Have you done as @knolleary suggested and asked INSIDE your company how to use the node?

Given you haven't released the node if the fields node isn't working properly you need to speak to the people who wrote it.

#15

Thanks for your support, I just solved the issue.