Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
With the OPC UA extension I was able to connect to the OPC UA server and read values. The config.json looks like:
{
"ws_connection": {
"host" : "localhost",
"port" : 80,
"app_key" : "***",
"thing_name" : "opcua_test",
"encryption" : "none",
"ignore_ssl_errors" : true,
"connect_retry_interval" : 10000,
"connect_timeout" : 10000,
"auto_scan_mode" : true,
"scan_rate" : 5000,
},
"opcua_endpoint_connection": {
"host" : "192.168.194.33",
"port" : 53530,
"server_name" : "OPCUA/SimulationServer",
"security_mode" : "none",
"request_timeout" : 60000,
"identity_provider" : "anonymous"
}
"opcua_subscription": {
"dataItems" : [
{
"name" : "MySwitch",
"baseType" : "BOOLEAN",
"identifier" : "MySwitch",
"namespaceIndex" : 2,
"isReadOnly" : false
}
]
}
}
Now i am trying to change the value of MySwitch from the Properties tab of the thing, but this doesn't work:
OPC UA Client terminal:
10:53:36.378 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameEncoder - Encoding WebSocket Frame opCode=2 length=51
10:53:39.995 [main] DEBUG c.d.o.sdk.client.fsm.SessionStateFsm - handleEvent(SessionRequested)
10:53:39.995 [main] DEBUG c.d.o.sdk.client.fsm.SessionStateFsm - semaphore acquired - handleEvent(SessionRequested)
10:53:39.995 [main] DEBUG c.d.o.sdk.client.fsm.SessionStateFsm - S(Active{}) x E(SessionRequested) = S'(Active{})
10:53:39.995 [ua-shared-pool-1] DEBUG c.d.o.s.c.fsm.ConnectionStateFsm - handleEvent(ConnectRequested)
10:53:39.995 [ua-shared-pool-1] DEBUG c.d.o.s.c.fsm.ConnectionStateFsm - semaphore acquired - handleEvent(ConnectRequested)
10:53:39.995 [ua-shared-pool-1] DEBUG c.d.o.s.c.fsm.ConnectionStateFsm - S(Connected{}) x E(ConnectRequested) = S'(Connected{})
10:53:39.995 [ua-shared-pool-1] DEBUG c.d.o.sdk.client.fsm.SessionStateFsm - semaphore released - handleEvent(SessionRequested)
10:53:40.011 [ua-shared-pool-2] DEBUG c.d.o.s.c.fsm.ConnectionStateFsm - semaphore released - handleEvent(ConnectRequested)
10:53:40.027 [main] DEBUG c.t.c.c.e.CommunicationEndpoint - Sending synchronous message, waiting for response [sync key: 9, message: APIRequestMessage [requestI
d: 9, endpointId: 0, sessionId: 3, method: POST, entityName: opcua_test, characteristic: Services, target: UpdateSubscribedPropertyValues]]
10:53:40.027 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameEncoder - Encoding WebSocket Frame opCode=2 length=182
10:53:40.027 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame opCode=2
10:53:40.027 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame length=17
10:53:40.027 [NettyClient-NIO-1] DEBUG c.t.c.c.e.DispatchingClientEndpoint - RESPONSE received [endpoint id: 0, duration: 0] ResponseMessage [requestId: 9, endp
ointId: 0, sessionId: -1, code: STATUS_SUCCESS, multipart: false, packet #: 0, total packets: 0]
10:53:42.023 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame opCode=2
10:53:42.023 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame length=68
10:53:42.023 [NettyClient-NIO-1] DEBUG c.t.c.c.e.DispatchingClientEndpoint - API REQUEST received [endpoint id: 0] APIRequestMessage [requestId: 22, endpointId:
-1, sessionId: -1, method: PUT, entityName: opcua_test, characteristic: Unknown, target: ]
10:53:42.023 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameEncoder - Encoding WebSocket Frame opCode=2 length=17
10:53:42.055 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame opCode=2
10:53:42.055 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame length=55
10:53:42.055 [NettyClient-NIO-1] DEBUG c.t.c.c.e.DispatchingClientEndpoint - API REQUEST received [endpoint id: 0] APIRequestMessage [requestId: 23, endpointId:
-1, sessionId: -1, method: GET, entityName: opcua_test, characteristic: Unknown, target: ]
10:53:42.055 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameEncoder - Encoding WebSocket Frame opCode=2 length=100
10:53:42.055 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame opCode=2
10:53:42.055 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame length=39
10:53:42.055 [NettyClient-NIO-1] DEBUG c.t.c.c.e.DispatchingClientEndpoint - API REQUEST received [endpoint id: 0] APIRequestMessage [requestId: 24, endpointId:
-1, sessionId: -1, method: GET, entityName: opcua_test, characteristic: Unknown, target: ]
10:53:42.070 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameEncoder - Encoding WebSocket Frame opCode=2 length=51
10:53:45.027 [main] DEBUG c.d.o.sdk.client.fsm.SessionStateFsm - handleEvent(SessionRequested)
10:53:45.027 [main] DEBUG c.d.o.sdk.client.fsm.SessionStateFsm - semaphore acquired - handleEvent(SessionRequested)
10:53:45.027 [main] DEBUG c.d.o.sdk.client.fsm.SessionStateFsm - S(Active{}) x E(SessionRequested) = S'(Active{})
10:53:45.027 [ua-shared-pool-1] DEBUG c.d.o.s.c.fsm.ConnectionStateFsm - handleEvent(ConnectRequested)
10:53:45.027 [ua-shared-pool-1] DEBUG c.d.o.s.c.fsm.ConnectionStateFsm - semaphore acquired - handleEvent(ConnectRequested)
10:53:45.027 [ua-shared-pool-1] DEBUG c.d.o.s.c.fsm.ConnectionStateFsm - S(Connected{}) x E(ConnectRequested) = S'(Connected{})
10:53:45.027 [ua-shared-pool-1] DEBUG c.d.o.sdk.client.fsm.SessionStateFsm - semaphore released - handleEvent(SessionRequested)
10:53:45.027 [ua-shared-pool-2] DEBUG c.d.o.s.c.fsm.ConnectionStateFsm - semaphore released - handleEvent(ConnectRequested)
10:53:45.043 [main] DEBUG c.t.c.c.e.CommunicationEndpoint - Sending synchronous message, waiting for response [sync key: 10, message: APIRequestMessage [request
Id: 10, endpointId: 0, sessionId: 3, method: POST, entityName: opcua_test, characteristic: Services, target: UpdateSubscribedPropertyValues]]
10:53:45.043 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameEncoder - Encoding WebSocket Frame opCode=2 length=182
10:53:45.058 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame opCode=2
10:53:45.058 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame length=17
10:53:45.058 [NettyClient-NIO-1] DEBUG c.t.c.c.e.DispatchingClientEndpoint - RESPONSE received [endpoint id: 0, duration: 15] ResponseMessage [requestId: 10, en
dpointId: 0, sessionId: -1, code: STATUS_SUCCESS, multipart: false, packet #: 0, total packets: 0]
Thank you.
Lyutskan, does it time out in the platform when you set the property value?
Hi Aanjan,
no, there is no timeout, no error message. The new value is set and shown briefly under Value. After few seconds or refresh the old value is back again. In the logs on the sever side is nothing to find, that the Value change has been initiated.
If the OPC UA Client is shutdown there is an error message, that the connection is not available, as expected.
Thank you for your help.
Is a value from the OPC server getting pushed constantly to the platform? It looks like you are setting a value in the platform, which goes to your server, but the OPC server is overriding/ sending back values that get written once again the platform. I would imagine that's why you see the values you set until the next push (5 seconds?) occurs.
The OPC UA client scans the OPC UA server every 5 seconds - "scan_rate" : 5000, then the OPC UA client send the value to thingworx. When the scan_rate is set to 50 seconds, there is enough time to change the value and to propagate it from thingworx to the client and then to the server. Unfortunately this doesn't work too. I scanned the traffic with Wireshark and saw, that when the value is changed in thingworx no request are send to the OPC UA server, but you can see in the client terminal, that the change is made. So I suppose that changing the value, or exactly sending the changed value to the server is not implemented in the OPC UA client and is not possible at the moment. Can you try to reproduce this. The setup is simple and a question of minutes.
Thank you.
I have almost this same issue, except that my property ConnectedtoOPCUAEndpoint has a value of false even though I get Property value updates for my tags. When I set the value of the OPC UA Tag Properties from a service test, it returns the org.mozilla.javascript.uniquetag@ not_found error.
Debug trace on the OPC Client Jar running in Powershell shows no mention of the attempt to set the value, but push notifications every 5 seconds show for the tag scans.
Debug trace on Monitor shows that the call is made from the OPCUAEndpoint to the API, with Characteristic: Property and Target: <tagname> showing correctly. The reply from the API is Characteristic:Unknown,target (blank).
Since I am able to read values but not set them, I'm pretty sure my config.json is set up correctly. Using extension and jar version 2.1 on Apache 8 with Thingworx 7. on Windows 2016 Server.