Hi @Galgani, Stefano Greetings! Welcome to Microsoft Q&A forum. Thank you for posting this question here.
I am checking to see if you got a chance to review the article Tutorial: Configure the OPC Publisher The article provides different options to configure the OPC publisher module. Let me know if that helps.
If you want to update the configuration from external modules, you can alternatively leverage the option Configuration via Cloud-based, Companion REST Microservice
You may refer the steps outline through the link Calling the Direct Methods API to get to know the steps involved in this approach. Please note that the Direct method approach has a pay load size limit of 256kb. If your payload size is greater that the allowed limit, you would want to take calling the API over HTTP approach. Kindly note that this feature is in preview and is not meant for production use.
You can call the API over HTTP to update the module twin. You can send HTTP requests to the publisher module http server at https://localhost:8081
. The unsecure endpoint is mounted at https://localhost:8080
for testing purposes. E.g. to get the swagger definition run:
curl http://localhost:8080/swagger/v2/openapi.json
To call the API you must authenticate to the built in HTTP server endpoint using an API Key. You can obtain the API key needed to authenticate from the publisher module twin. e.g., using the AZ CLI tool you can run
az iot hub module-twin show -m publisher -n <hub name> -d <iotedgehubdev device name>
If the OPC Publisher has successfully started then this will produce e.g., output as follows:
...
"$version": 3,
"__apikey__": "6dee3fd4-0bb2-4fb1-9736-99bb4435f020",
"__type__": "OpcPublisher",
"__version__": "2.9.0"
...
You can now send HTTP requests to the publisher module http server at https://localhost:8081 with the Authorization header Bearer 6dee3fd4-0bb2-4fb1-9736-99bb4435f020. E.g., to call this API with the previously retrieved API Key run.
curl -H "Authorization: Bearer 6dee3fd4-0bb2-4fb1-9736-99bb4435f020" https://localhost:8081/v2/configuration
{"endpoints":[]}
To update the configuration twin setting, you can use the command az iot hub module-twin update
Please find more details about the command through the link az iot hub module-twin update
Can this be achieved through OPC twin
I believe OPC twin serves a different purpose than module twin. The OPC twin uses microservices and an Azure IoT Edge module to connect the cloud to a factory network. OPC Twin provides discovery, registration, and synchronous remote control of industrial devices through REST APIs. OPC Twin also supports the OPC HDA profile for historical data. These features are the same as the module twin capabilities which are designed to store module related information such as tags, desired properties, related properties and module identity properties.
Hope this helps. Please let us know if you have any additional questions.