Engineering-Research-and-Development / iotagent-opcua

IoT Agent for OPC UA protocol
https://iotagent-opcua.rtfd.io/
GNU Affero General Public License v3.0
42 stars 20 forks source link

Unable to update/write values in OPCUA Simulated Server using Fiware #76

Closed umerusman34 closed 1 year ago

umerusman34 commented 2 years ago

I am trying to do two communication to read and write values from OPCUA Simulated Server using Fiware. I am successful in reading the values from the server.

Screenshot (48) . However, I am still facing issues in updating/writing the values. I am using this to update the value.

`{   
    "actionType": "update",
    "entities": [

        {
         "id": "age01_7:Simulation",
         "type": "3:Simulation",
         "3:test2": {
            "type": "Number",
            "value": "44",
            "metadata": {}

         }
        }
        ]
}`

It is working with http://localhost:1026/v2/op/update but it only updates the value within the container, not in the Server. Also, when I try to update using this http://localhost:4001/v2/op/update it gives me this error after several minutes

Screenshot (49)

umerusman34 commented 2 years ago

@jason-fox @manfredipist

MattiaMarzano-Eng commented 2 years ago

Hello @umerusman34, this is a feature not supported from OPC UA Agent, unless you're invoking a method(command) on your server in charge of updating variables. I mean currently you cannot update the variable on your server sending the update directly to OCB or to the Agent, but you can only invoke a method/command from the agent to your server which will do the work you expect.

umerusman34 commented 2 years ago

@MattiaMarzano-Eng Thank you for your reply. Can you please elaborate a bit more on what exactly are you suggesting?

You can only invoke a method/command from the agent to your server which will do the work you expect

MattiaMarzano-Eng commented 2 years ago

Taking as example our server where a command "Accelarate" is implemented, you can invoke it from the Context Broker and through the agent is provided to the Server which has the logic to change the variable value "Speed". image What you can do in case you have the control on OPC UA server is to implement a command that when is invoked on Context Broker updates accordingly the relative variable in the server. Here the example I mentioned from our OPC UA server developed for demo purpose

manfredipist commented 1 year ago

Hi @umerusman34! Please download the latest version of the agent (v2.0.5) which now features OPC UA variables update without command execution (proper get/set methods for the variable will need to be implemented though). Under the given circumstances you will be able to update a variable using the following REST API

PUT http://ORION_ENDPOINT:ORION_PORT/v2/entities/ENTITY_NAME/attrs/ENTITY_ATTRIBUTE?type=ENTITY_TYPE body: { "type" : "Number", "value" : 5 }