Skip to main content
1-Visitor
August 12, 2016
Question

Does the OPC UA client extension support bidirectional communication or just reading values from the server?

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.

5 replies

5-Regular Member
August 12, 2016

Lyutskan, does it time out in the platform when you set the property value?

Translate
1-Visitor
August 15, 2016

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.

Translate
5-Regular Member
August 15, 2016

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.

Translate