Two exactly same flows - only one working

I'm using node-red-contrib-s7 to read and write to a Siemens s7-1200 PLC. I developed this on my PC, and then exported the flow to my new raspberry pi (my first). It is communicating and I can write and read but I have one payload containing array[24] that wont write to the PLC. It's working on the PC but not raspberry pi, it says "Error: Number of tags must match the number of values". But it does, it's the same flow on both node-red running? I even run them simultanious and one can write and the other can't. What can the problem be?

There are several questions we don't know the answer to. Are you running the same Node-Red on both with the same pallets? Does the hardware have the same capabilities? How did you make the flows identical? One thing you can do is to have your output nodes run everything into a JSON string converter to see if the output strings are identical between the two systems. If they are, there's something else different. But for right now, it sounds like your Pi is trying to transmit something that isn't being seen as a value. Check your outputs on both prior to the S7 node to see what's being passed and go from there.

I think I managed to get the pc and raspi on the same versions, I exported the flow from pc and imported on raspi. I have checkes the output with debug and both are similar. I will check more in depth tomorrow. Thank yoy

The payload is identical on both node-red instances:



I can write other values to the PLC from node-red on the raspi but not this array. But I can on the PC. Any advise on how to proceed?

EDIT: One thing that came to my mind, the Raspi language is Swedish but the system interface is still English. My PC is Swedish, can this effect something? I mean, it's diffrent csv sign for diffrent languages. Sometime it's semicolon and sometimes only comma. Since this array is seperated with colon, maybe it's interpred wrong?

rQx, some info just vanished but you did say one device was Swedish locales and one English. I wonder if it is the decimal separator causing issues. English period and Swedish comma. Just a thought.

Yes, I edited my comment two times. So it got detected for spam. I just wrote that, that the comma seperator could be the problem. It's written as comma on both now. How can I change it? If I change raspi to swedish it doesn't change the system it seems

Sorry I have no idea about Pi settings, I do not use Raspberry Pi. There are plenty of users here that do, so you should get some help.

I would ask how is this array generated, what /where is the input data coming from?
Can we see some screenshots of the arrays going in to the s7 node in the debug side bar.
Also may help to post the flow json also.

Since it seems a little bit complicated to change the CSV symbol in node-red, it always seem to be "," . I descided to just split the array in a functionblock to 24 outputs. Sending 24 messages instead of 1.

If I split and join etc, I always got the ",", even if I changed a string to all values to ";" seperated. Joining them to array again made them ",".

One thing to look at, it's a Raspberry Pi you're talking about. Pull out your SD card, slip in a new one and install an English version of the OS onto the card. It will be simple to install NR and import your flows onto the new setup. That way if it doesn't work, you can just slip in your old SD card and lose nothing. Beats trying to change locales and everything that goes with it. Once you prove whether or not it's the locale setup, you can then undertake the effort to change the locale on your old setup.

In any case, it sounds like there are workarounds, even if they're not the desired final setup. It wouldn't be the first time something as trivial as a locale broke an entire program.

Thanks for the tip! I can change the locale in the settings for raspi, but the "system" remains english.

But I wonder if that is the problem, if it would then the node wouldnt work on english PCs right?

Not sure if I understand what you mean. I possibly do, but I'm going to run off of an assumption and answer it that way.

There are two scenarios you're up against, assuming it's the locale that's the problem and not some hardware feature of the Pi. The first scenario I'll spell out is that you have two locales at play and not just one. The first locale is the Node-Red locale. This will change the appearance of the Node-Red editor itself and not affect the underlying code. Good for formatting outputs in a way you understand and displaying things like time, dates and whatnot in a local fashion. But like I said, the underlying code wouldn't be affected because it operates in the background off of the other locale, the system locale. This locale dictates the base locale that all programs and the system itself uses, provided the program doesn't override it (which in this case Node-Red editor would). Since the interpreter is running in the background under the system locale, decimal numbers may use a comma character instead of a decimal, dates may format differently or other even local characters may be substituted into the place of what you programmed. The last may be an extreme, but still possible.

The second scenario is changing the locale in Node-Red changes the locale for all of Node-Red. The editor, interpreter and everything is changed. But, the interpreter may still be passing data to the system for transmission on a system managed communication channel. The system can receive a float number and in converting it to a string, uses a comma instead of a decimal. Not very likely but again, possible.

I guess the third scenario is it's not the locale at all but something about your Pi.

In any case, you have an English system that works. You have a Swedish system that doesn't. Either it's the locale or the system because everything else appears equal. The easiest thing to do is try a different locale and see if it fixes it. If not, you may have a system problem.

The last-last thing I can think of while typing this (and not very likely at all) is that somehow where you got your Pi distribution of Node-Red has an altered version without a certain item that makes your flows work. Like I say though, that's not likely at all because the JavaScript files Node-Red uses are identical and only the interpreter really changes. But it's still a possibility that must be considered.

In any case, if you try a fresh English install on a different SD card first, you'll have an easy test where nothing is lost that eliminates half of the vlarge variables. If that doesn't work, we have a really good idea what to chase next.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.