Function payload to tagpath ignition write problem

#1

I am wanting to use this function to push my msg.payload and push to the tag path of the ignition module which should be msg.payload.tagpath. I am doing something wrong in my function module, any ideas on how I can accomplish this task?

msg.payload = msg.payload.tagpath
return msg;

#2

If I understand you correctly, I don’t think it is possible.

In one message msg.payload cannot be a variable AND also be an object.

Do you just want it to be an object?
i.e move msg.payload to ms.payload.tagpath?

#3

My goal is to update the tag path in the ignition module from the CSV so it is very possible I am going about this task completely wrong. the value I am getting from debug on the CSV and on the function are appearing correctly, but it is not passing to the tag path of the ignition module. Based on the ignition module, msg.payload.tagpath is the syntax for the tag path location.

#4

If you want to move msg.payload to msg.payload.tagpath you need to make msg.payload an object first.

It is easier to do it with a Change node

[{"id":"55bc638e.82137c","type":"inject","z":"73cf958f.f83d04","name":"","topic":"","payload":"test","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90.5,"y":438,"wires":[["d403e581.c1b3"]]},{"id":"d403e581.c1b3","type":"change","z":"73cf958f.f83d04","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.tagpath","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":318.5,"y":440,"wires":[["6731be83.313068"]]},{"id":"6731be83.313068","type":"debug","z":"73cf958f.f83d04","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":556.5,"y":441,"wires":[]}]

#5

The change does seem to make the change as needed for the debug, but still getting invalid tag path. Not sure why exactly.

Here is my flow if that makes it easier. By the way, I really appreciate you helping out with this, I am very novice with Node Red.

PRSTAXIN is the value I want to show in the tag path by the way.

[{"id":"e98fae31.a1e91","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"b2a71f8f.e9049","type":"inject","z":"e98fae31.a1e91","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":154,"y":56,"wires":[["7b6e509.45fffb"]]},{"id":"7b6e509.45fffb","type":"file in","z":"e98fae31.a1e91","name":"","filename":"C:\\Users\\justin.huggins\\Nodered.csv","format":"lines","chunk":false,"sendError":false,"encoding":"none","x":409.5,"y":58,"wires":[["f2455966.45a5c8"]]},{"id":"f2455966.45a5c8","type":"csv","z":"e98fae31.a1e91","name":"","sep":",","hdrin":"","hdrout":"","multi":"one","ret":"\\n","temp":"","skip":"0","x":669,"y":59,"wires":[["92d22fe3.944de"]]},{"id":"2e6e08d.8d6e8f8","type":"ignition-tag-write","z":"e98fae31.a1e91","server":"34b12946.f6e0b6","value":"","valueType":"msg.payload","tagPath":"","tagValue":"","name":"","x":1089,"y":63,"wires":[[]]},{"id":"92d22fe3.944de","type":"change","z":"e98fae31.a1e91","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.tagpath","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":849,"y":60,"wires":[["2e6e08d.8d6e8f8","b3890d53.54e48"]]},{"id":"b3890d53.54e48","type":"debug","z":"e98fae31.a1e91","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1074,"y":186,"wires":[]},{"id":"34b12946.f6e0b6","type":"ignition-server","z":null,"hostname":"localhost","port":"8088","ssl":false,"defaultTagProvider":"edge","name":""}]
#6

Your flow without saying which node you are using isn't much use.

What happens if you break the problem down and use an inject node to inject the data into the change node and onto your "tag path" node?

The csv node you have configured to output a message per row, so is each row of your csv just the "PRSTAXIN" value you want to submit?

#7

My apologies, this is the node node-red-contrib-ignition-nodes. The CSV just has one value for now, but essentially I want to be able to update the CSV with tag paths instead of updating my node in the flow.

The direct inject does not seem to like it either.

[{"id":"2e6e08d.8d6e8f8","type":"ignition-tag-write","z":"e98fae31.a1e91","server":"34b12946.f6e0b6","value":"","valueType":"msg.payload","tagPath":"","tagValue":"","name":"","x":878,"y":450,"wires":[[]]},{"id":"54a745f7.0e98cc","type":"inject","z":"e98fae31.a1e91","name":"","topic":"","payload":"PRSTAXIN","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":405,"y":442,"wires":[["4fef60d1.6d7fd"]]},{"id":"4fef60d1.6d7fd","type":"change","z":"e98fae31.a1e91","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.tagpath","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":611,"y":448,"wires":[["2e6e08d.8d6e8f8"]]},{"id":"34b12946.f6e0b6","type":"ignition-server","z":null,"hostname":"localhost","port":"8088","ssl":false,"defaultTagProvider":"edge","name":""}]
#8

Have you read the info panel for the node?

Basic Usage

The tag path must be a valid Ignition tag path. A tag path looks like this:

**[Tag Provider]folder/path/tagname

If the tag provider, [Tag Provider] , is left out of the tag path, the default tag provider will be used from the server configuration.

The tag value is the value you would like to write.

So I'd guess that "PRSTAXIN" isn't a valid path and if it is what value are you sending?

#9

Ah, good point. This must be developed around Ignition 8. 7.9 does not require this type of pathing, I will give that a shot. Might be my problem the whole time.