IgnitionModuleDevelopmentCommunity / IgnitionNode-RED

Adds support for Node-RED
Apache License 2.0
31 stars 7 forks source link

Ignition Tag Write Node Error when attempting to write multiple tags as an array to Ignition Edge #20

Closed cguillory7280 closed 2 years ago

cguillory7280 commented 2 years ago

Node-RED v0.25.5 running on a MultiTech Conduit300 with Ignition-Edge-linux-armhf-8.1.10.

When trying to perform a multiple tags following the Ignition Tag Write node documentation shown below, the catch node reports "message: "TypeError: Cannot read property 'defaultTagProvider' of undefined"" even though the tagPath contains the tag provider and same path that works with a single tag write. The documenation states for multiple tags written as an array, in the Dynamic Settings, "msg.payload.defaultTagProvider - the realtime tag provider name to use if not specified in the tag path.". Being that the Ignition Edge running on this unit does not have a Realtime Tag Provider as defined in a standard Ignition installation, is this causing the error or am I missing something else?

Writing to multiple tags as arrays: { "tagPath": [ "[default]Writeable/WriteableInteger1", "[default]Writeable/WriteableInteger2" ], "tagValue": [ 300, 400 ] }

The entire error message is below:

error: object message: "TypeError: Cannot read property 'defaultTagProvider' of undefined" source: object id: "6ee3d596.901a9c" type: "ignition-tag-write" count: 1 stack: "TypeError: Cannot read property 'defaultTagProvider' of undefined↵ at IgnitionNodesImpl.addMsg (/var/config/app/install/development/node_modules/node-red-contrib-ignition-nodes/node-handlers.js:54:46)↵ at createIgnitionTagWriteNode. (/var/config/app/install/development/node_modules/node-red-contrib-ignition-nodes/node-handlers.js:275:14)↵ at createIgnitionTagWriteNode.emit (events.js:314:20)↵ at createIgnitionTagWriteNode.Node.receive (/opt/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:237:14)↵ at FunctionNode.Node.send (/opt/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:224:14)↵ at sendResults (/opt/node-red/node_modules/@node-red/nodes/core/core/80-function.js:52:18)↵ at FunctionNode. (/opt/node-red/node_modules/@node-red/nodes/core/core/80-function.js:231:21)↵ at FunctionNode.emit (events.js:314:20)↵ at FunctionNode.Node.receive (/opt/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:237:14)↵ at Func..."

iatraviscox commented 2 years ago

What version do you have installed for the node-red-contrib-ignition-nodes?

image

Do you see "Default Tag Provider" on the Ignition Server attached to the write node?

image

If you add "defaultTagProvider" to the incoming payload does it work properly?

iatraviscox commented 2 years ago

The issue is that the message being passed in doesn't contain the payload object. Your message coming into the Ignition write node is:

{ "tagPath": [ "[default]Writeable/WriteableInteger1", "[default]Writeable/WriteableInteger2" ], "tagValue": [ 300, 400 ] }

The node expects "tagPath" and "tagValue" inside of a "payload" object. Try the following:

{ "payload": { "tagPath": [ "[default]Writeable/WriteableInteger1", "[default]Writeable/WriteableInteger2" ], "tagValue": [ 300, 400 ] } }

cguillory7280 commented 2 years ago

That solved my problem. Thank you.