mikakaraila / node-red-contrib-opcua

A Node-RED node to communicate OPC UA. Uses node-opcua library.
Other
208 stars 191 forks source link

Change localeId for OpcUa-Client to "de-DE" #618

Open CA1458 opened 9 months ago

CA1458 commented 9 months ago

Hello,

I am able to get alarms&events via opc-ua from a Siemens 840d sl machine with the nodes OpcUa-Event and OpcUa-Client. I get the alarms in the language "en-EN".

In UAExpert I can change the localeId from the client to "de-DE" and then I get the alarms in German. How can I fix this in nodeRED?

Thank you and best regards

mikakaraila commented 9 months ago

Not implemented nor supported at the moment. This will need code changes...

CA1458 commented 9 months ago

Not implemented nor supported at the moment. This will need code changes...

Hmm ok. Can I change this on my own in the code? If Yes, where?

mikakaraila commented 9 months ago

I expect this could be place to add check and select wanted locale in case of field that is type of LocalizedText: image

CA1458 commented 9 months ago

I expect this could be place to add check and select wanted locale in case of field that is type of LocalizedText: image

Hello @mikakaraila, thanks for the image. Unfortunately, I don't know what new code I have to add here...

mikakaraila commented 9 months ago

So it´s not so obvious to make changes as I expected... if I have time this or next week I will take a look. Just one if + some code and settings from somewhere... cannot promise this 100%.

CA1458 commented 9 months ago

So it´s not so obvious to make changes as I expected... if I have time this or next week I will take a look. Just one if + some code and settings from somewhere... cannot promise this 100%.

ok thank you!

mikakaraila commented 9 months ago

UaExpert setting: image

Corresponding in node-red: https://groups.google.com/g/node-red/c/tg50hmJ0b8c

Or use directly OS locale inside my code...

CA1458 commented 9 months ago

UaExpert setting: image

Corresponding in node-red: https://groups.google.com/g/node-red/c/tg50hmJ0b8c

Or use directly OS locale inside my code...

Yes this change I made in UaExpert and then I got the alarms in German.

CA1458 commented 9 months ago

So it´s not so obvious to make changes as I expected... if I have time this or next week I will take a look. Just one if + some code and settings from somewhere... cannot promise this 100%.

@mikakaraila maybe you can have a look if you have time thanks

mikakaraila commented 8 months ago

Some progress, can you provide me which locales your LocalizedText contains?

12 Oct 13:41:03 - [debug] [OpcUa-Client:A & C] Event Field: Message [{"dataType":"1","arrayType":"2","value":"3"},"LocalizedText","Scalar",{"locale":"4","text":"5"},"","Level exceeded"] OS Locale: en-FI Locale: Message: Level exceeded

image

I will use default text but if OS Locale matches with containing LocalizedText message locale then it will be used.

CA1458 commented 8 months ago

@mikakaraila this is what I get in NodeRED:

image

mikakaraila commented 8 months ago

UaExpert and how many message LocalizedText it will contain?

CA1458 commented 8 months ago

UaExpert and how many message LocalizedText it will contain?

UaExpert: image

image

mikakaraila commented 8 months ago

Hmm, it shows only the current locale message. I made change and published new version, test with it. But if you look same structure in Data view you should see that message LocalizedText should be array. My code will try to select current OS locale text from the array.

CA1458 commented 8 months ago

Hmm, it shows only the current locale message. I made change and published new version, test with it. But if you look same structure in Data view you should see that message LocalizedText should be array. My code will try to select current OS locale text from the array.

I testet the new version v0.2.315, but the result is the same...

It would be great, If I could type in the desired localeId language in NodeRed opc-ua-client like in UaExpert...

mikakaraila commented 8 months ago

What comes to console? I added there output to see what happens as I cannot test this with my servers.

CA1458 commented 8 months ago

I`m running nodeRED on Windows Where can I find the console for NodeRED?

mikakaraila commented 8 months ago

If you start it from the command line: node-red FLOWFILE.json Then it should be there...

CA1458 commented 8 months ago

There I get a error message for the flow credentials, that they are encryped.

I have also a NodeRED running on Ubunto. The System language is German. v0.2.316 Here are the screens:

image image image

CA1458 commented 8 months ago

Hi @mikakaraila,

on Windwos I have the same output in console. Do you have any idea?

image

mikakaraila commented 8 months ago

Look alarm object and message variable, does it contain array of LocalizedText? image

CA1458 commented 8 months ago

Hello @mikakaraila, this is what I get in UaExpert, if I choose the SINUMERIK in the alarm event:

image

CA1458 commented 8 months ago

I have no massage or alarm object. Sinumerik has a own alarm event

mikakaraila commented 8 months ago

Deep dive => open/browse what is inside address space under Sinumerik?

mikakaraila commented 8 months ago

It seems that we are missing ActivateSession with localeIds. So there is no API for client to request messages with another locale.

CA1458 commented 8 months ago

@mikakaraila I have opened the Sinumerik and activate all

image

mikakaraila commented 8 months ago

Look address space tree on the left, but anyway there is no support in SDK for this feature. So I cannot implement it.