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

Transformation to OCB does not work with manual provisioning of the IoTAgent #126

Closed manolait closed 8 months ago

manolait commented 10 months ago

Hello,

I am having problems when performing the provisioning of the device through the REST API. If I perform the configuration through the file, config if it works. Also, I think there is missing information on how to provision devices and groups in the tutorials.

I am using this:

{
    "devices": [
        {
            "device_id": "age01_Car",
            "entity_name": "age01_Car",
            "entity_type": "Device",
            "apikey": "iot",
            "service": "opcua_car",
            "subservice": "/demo",
            "attributes": [
                 {
                    "name": "SCADAASPAnalogInput_10PresentValue",
                    "type": "Float"
                  },
                  {
                    "name": "SCADAASPAnalogInput_11PresentValue",
                    "type": "Float"
                  }
            ],
            "lazy": [
            ],
            "commands": [
            ],
            "endpoint": "opc.tcp://1xxxxxxxx:49320"
        }
    ]
}

searching on the internet I have seen that maybe you should add

"object_id": "ns=2;s=SCADA.ASP.AnalogOutput_10.PresentValueRel",

Complete:

{
    "devices": [
        {
            "device_id": "age01_Car",
            "entity_name": "age01_Car",
            "entity_type": "Device",
            "apikey": "iot",
            "service": "opcua_car",
            "subservice": "/demo",
            "attributes": [
                 {
                    "name": "SCADAASPAnalogInput_10PresentValue",
                    "object_id": "ns=2;s=SCADA.ASP.AnalogOutput_10.PresentValueRel",
                    "type": "Float"
                  },
                  {
                    "name": "SCADAASPAnalogInput_11PresentValue",
                     "object_id": "ns=2;s=SCADA.ASP.AnalogInput_11.PresentValue",
                    "type": "Float"
                  }
            ],
            "lazy": [
            ],
            "commands": [
            ],
            "endpoint": "opc.tcp://192.xxxxx:49320"
        }
    ]
}

but we have the following error: ``` { "name": "WRONG_SYNTAX", "message": "Wrong syntax in request: Errors found validating request." }



this version of the docker image is `image: iotagent4fiware/iotagent-opcua:2.2.0`

How can I add devices?

Thank you, best regards.
walterwootz commented 9 months ago

Hi @manolait, We are facing some problems regarding API provisioning related to iotagent-node-lib. We already opened an issue and are waiting for support to fix it. We recommend using config.js autoprovisioning at the moment.

manfredipist commented 9 months ago

Hi @manolait you should add property "relaxTemplateValidation" inside config.iota object and set it to true to solve your issue related to "WRONG_SYNTAX". Regarding the provisioning of the device, OCB will get updated only once proper measured are received as discussed in the following issue (https://github.com/telefonicaid/iotagent-node-lib/issues/1575)