diff --git a/README.md b/README.md index f87a5e8..63d5a19 100755 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # Connecting USB QR Code Scanner -Connecting an USB based QR Code Scanner to an Industrial Edge Device. +Connecting an USB based QR code scanner to an Industrial Edge Device. - [Connecting USB QR Code Scanner](#connecting-usb-qr-code-scanner) - [Description](#description) - [Overview](#overview) - - [General task](#general-task) + - [General Task](#general-task) - [Requirements](#requirements) - - [Used components](#used-components) + - [Used Components](#used-components) - [TIA Project](#tia-project) - [Configuring PLC Connection](#configuring-plc-connection) - [Installation](#installation) @@ -22,29 +22,30 @@ Connecting an USB based QR Code Scanner to an Industrial Edge Device. ### Overview -This application examples shows how to connect a QR Code Scanner via USB to the Industrial Edge Device. The scanned QR Code will be sent to a PLC and displayed in an HMI Panel. +This application examples shows how to connect a QR code scanner via USB to the Industrial Edge Device. The scanned QR code will be sent to a PLC and displayed in an HMI Panel. -### General task +### General Task -The application reads the QR Code provided by the scanner and publishes it on the Databus to the topic corresponding to the OPC UA Connector, which sends the data to the PLC. This topic needs to be created in the Databus in advance. -Scanner type, plc tag, databus topic as well as databus credentials can be configured via an external configuration file. +The application reads the QR code provided by the scanner and publishes it on the Databus to the topic corresponding to the OPC UA Connector, which sends the data to the PLC. This topic needs to be created in the Databus in advance. +The scanner type, PLC tag, Databus topic as well as Databus credentials can be configured via an external configuration file. ![deploy VFC](docs/graphics/qrcode_task.png) ## Requirements -### Used components +### Used Components -- Industrial Edge App Publisher V1.10.5 -- Docker Engine 18.09.6 -- Docker Compose V2.4 -- OPC UA Connector V1.8.1 -- Common Connector Configurator V1.8.1-4 -- Databus V2.1.0-4 +- Industrial Edge App Publisher V1.12.7 +- Docker Engine 24.0.6 +- Docker Compose V2.21.0 +- Common Connector Configurator V1.9.1-1 +- Databus V2.3.1-2 - Databus Configurator V2.0.0-5 -- Industrial Edge Device V1.10.0-9 +- Industrial Edge Device V1.12.0-10 +- IE App Configuration Service V1.3.2 +- OPC UA Connector V2.1.0-0 - QR Code Scanner: SIMATIC MV320 -- TIA Portal V16 +- TIA Portal V18 (V16 minimum) - PLC: CPU 1518 FW 2.8.3 ### TIA Project @@ -55,36 +56,36 @@ The used TIA Portal project can be found in the [miscellaneous repository](https ### Configuring PLC Connection -Further information about how to configure the OPC UA Connection to write data to the PLC can be found in the [docs](docs/PLC_connection.md) section +Further information about how to configure the OPC UA Connector to write data to the PLC can be found in the [docs](docs/PLC_connection.md) section. -- Configure Databus -- Configure OPC UA Connection +- [Configure Databus](docs/PLC_connection.md#configuring-databus) +- [Configure OPC UA Connector](docs/PLC_connection.md#configuring-opc-ua-connector) ## Installation -You can find the further information about the following steps in the [docs](./docs/Installation.md) +You can find further information about the following steps in the [docs](./docs/Installation.md) - [Configure QR Code Scanner](docs/Installation.md#configure-qr-code-scanner) - [Build application](docs/Installation.md#build-application) -- [Upload app to Industrial Edge Management](docs/Installation.md#upload-scanner-app-to-the-industrial-edge-managment) -- [Deploying application to Industrial Edge Device](docs/Installation.md#deploying-of-qr-code-scanner-demo) +- [Upload scanner app to the Industrial Edge Management](docs/Installation.md#upload-scanner-app-to-the-industrial-edge-management) +- [Configuring Application](docs/Installation.md#configuring-application) +- [Create & Deploy of QR code scanner demo](docs/Installation.md#create--deploy-configuration-file) ## Usage -Plug your SIMATIC MV320 Bar Code Scanner (or any other USB Scanner) to one of the USB Ports of your Industrial Edge Device. +Plug your SIMATIC MV320 QR code scanner (or any other USB Scanner) to one of the USB ports of your Industrial Edge Device. -Go to the TIA Portal Project, start the HMI Runtime and scan any available QR Code (e.g the following QR Code). A pop up will appear with the content of the scanned code. +Go to the TIA Portal Project, start the HMI Runtime and scan any available QR code (e.g., the following QR code). A pop up will appear with the content of the scanned code. -You can also open the GBD data block in the TIA Portal and check the content of the APP_QRCode variable in the app signals structure. +You can also open the GBD data block in the TIA Portal and check the content of the APP_QRCode variable in the appSignals structure. ![QR_Code_Industrial_Edge](docs/graphics/qr_code_industrial_edge.png) ## Implementation - -How to access the USB based QR Code Scanner inside the application as well as further details about the source code can be found in the [implementation section](docs/Implementation.md). +The access to the USB based QR code scanner inside the application as well as further details about the source code can be found in the [implementation](docs/Implementation.md) section. - [Accessing QR Code Scanner](docs/Implementation.md#accessing-qr-code-scanner) inside the application -- [Publishing QR Code](docs/Implementation.md#accessing-qr-code-scanner) to the Databus +- [Publishing QR Code](docs/Implementation.md#publishing-code-to-databus) to the Databus ## Documentation diff --git a/cfg-data/json_schema/param.json b/cfg-data/json_schema/param.json index 8b31059..2cbecec 100755 --- a/cfg-data/json_schema/param.json +++ b/cfg-data/json_schema/param.json @@ -83,19 +83,19 @@ }, "Topic": { "title": "IE Databus topic", - "default": "ie/d/j/simatic/v1/s7c1/dp/w/PLC_S7", + "default": "ie/d/j/simatic/v1/opcuac1/dp/w/PLC_OPC", "type": "string", "minLength": 1 }, "Variable": { "title": "PLC Varibale", - "default": "GDB_appSignals_APP_QRCode", + "default": "GDB.appSignals.APP_QRCode", "type": "string", "minLength": 1 }, "Metadata": { "title": "Metadata", - "default": "ie/m/j/simatic/v1/s7c1/dp", + "default": "ie/m/j/simatic/v1/opcuac1/dp", "type": "string", "minLength": 1 }, diff --git a/cfg-data/param.json b/cfg-data/param.json index ae92f5e..f90e229 100644 --- a/cfg-data/param.json +++ b/cfg-data/param.json @@ -1,9 +1,9 @@ - { +{ "Scannertype": "Siemens AG MV320", "Mqtt_Broker_Server": "ie-databus", "User": "edge", "Password": "edge", - "Metadata": "ie/m/j/simatic/v1/s7c1/dp", - "Topic": "ie/d/j/simatic/v1/s7c1/dp/w/PLC_S7", - "Variable": "GDB_appSignals_APP_QRCode" + "Metadata": "ie/m/j/simatic/v1/opcuac1/dp", + "Topic": "ie/d/j/simatic/v1/opcuac1/dp/w/PLC_OPC", + "Variable": "GDB.appSignals.APP_QRCode" } \ No newline at end of file diff --git a/docs/Implementation.md b/docs/Implementation.md index 35cf9d0..8805920 100755 --- a/docs/Implementation.md +++ b/docs/Implementation.md @@ -13,7 +13,7 @@ ### Accessing input events -Using an USB QR Code Scanner in Linux the Scanner is mounted to the generic input event interface located in /dev/input/. In this application example the python-evdev library is used to read the input events of the Industrial Edge Device. The evdev interface passes events generated in the kernel directly to user space through character devices typically located in the mentioned /dev/input/ folder. +When using an USB QR code scanner in Linux the scanner is mounted to the generic input event interface located in /dev/input/. In this application example the python-evdev library is used to read the input events of the Industrial Edge Device. The evdev interface passes events generated in the kernel directly to user space through character devices typically located in the mentioned /dev/input/ folder. The python-evdev libray can be used in your python script by importing evdev: *import evdev* @@ -27,7 +27,6 @@ To enable the access to the input devices, the application needs to have access > build: ./src > image: scannerap:1.2.0 > restart: on-failure -> privileged: true > mem_limit: 100mb > networks: > - proxy-redirect @@ -39,9 +38,9 @@ To enable the access to the input devices, the application needs to have access ### Check for dedicated input device -As not all input events should be monitored, but only the events of the QR Code Scanner the application checks for a device with a dedicated name. The device name can be configured via the configuration file. +As not all input events should be monitored, but only the events of the QR code scanner the application checks for a device with a dedicated name. The device name can be configured via the [config file](../cfg-data/param.json). -The check is done in the **check_for_scanner** function in the **main.py** script. The function lists all devices provided by the evdev library (list_devices), checks for the scanner name and returns the corresponding event to the main function +The check is done in the **check_for_scanner** function in the **main.py** script. The function lists all devices provided by the evdev library (list_devices), checks for the scanner name and returns the corresponding event to the main function. **Excerpt from main.py:** @@ -61,13 +60,13 @@ The check is done in the **check_for_scanner** function in the **main.py** scrip ## Publishing Code to Databus -After the QR Code is scanned and read by the application it is published to the S7 Connector topic of the IE Databus. As the IE Databus is based on a MQTT Broker the python library **paho-mqtt** is used to publish values on the IE Databus. +After the QR code is scanned and read by the application it is published to the OPC UA Connector topic of the IE Databus. As the IE Databus is based on a MQTT broker the python library **paho-mqtt** is used to publish values on the IE Databus. -This library can be import by: **import paho.mqtt.client** **as** **mqtt** +This library can be imported by: **import paho.mqtt.client** **as** **mqtt** ### Initializing MQTT client -Before publishing data to the IE Databus the MQTT Client needs to be initialized, the connection to the broker established and the loop for accessing the broker started. As the IE Databus is protected by user and password the credentials needs to be set before connect to the broker. +Before publishing data to the IE Databus the MQTT client needs to be initialized, the connection to the broker established and the loop for accessing the broker started. As the IE Databus is protected by user and password the credentials need to be set before connecting to the broker. **Excerpt from main.py:** @@ -79,7 +78,7 @@ Before publishing data to the IE Databus the MQTT Client needs to be initialized self.client.loop_start() ``` -The mqtt connection is handled by the the `class mqttclient`, which is initialized when creating the class object. All needed parameters are handed over by the class constructor and can be configured using the [config file](../cfg-data/param.json). +The MQTT connection is handled by the the `class mqttclient`, which is initialized when creating the class object. All needed parameters are handed over by the class constructor and can be configured using the [config file](../cfg-data/param.json). **Excerpt from main.py:** @@ -91,14 +90,14 @@ The mqtt connection is handled by the the `class mqttclient`, which is initiali ### Publishing QR Code -As soon as the suffix (enter character) of the QR Code is detected by the application the scanned code is published to IE Databus. The QR Code as well as the IE Databus topic are printed to the logs using the **print** and **flush** commands. +As soon as the suffix (enter character) of the QR code is detected by the application the scanned code is published to IE Databus. The QR code as well as the IE Databus topic are printed to the logs using the **print** and **flush** commands. **Excerpt from main.py:** ```python # Check for QRCode suffix if event.code == CONST_ENTER: - # Copy barcode to S7 Connector topic + # Copy barcode to OPCUA Connector topic PLC_QR_Code['vals'][0]['id'] = (my_mqtt_client.IDDict.get(params['Variable'])) PLC_QR_Code['vals'][0]['val'] = barcode # Publish MQTT Topic and flush to logs @@ -110,7 +109,7 @@ As soon as the suffix (enter character) of the QR Code is detected by the applic barcode = "" ``` -The mqtt topic of the S7 Connector for writing to the PLC uses the following format: +The MQTT topic of the OPC UA Connector for writing to the PLC uses the following format: ```json { @@ -122,7 +121,7 @@ The mqtt topic of the S7 Connector for writing to the PLC uses the following for ``` The sequence number **seq** is optional and has no further value here. -The **vals** structure describes the data block variable of the PLC and consist the +The **vals** structure describes the data block variable of the PLC and consists two entries: - **id**: Variable id, defined in the meta data of the connection. -- **val**: Value of the variable. In this case the *QR Code*. +- **val**: Value of the variable. In this case the *QR code*. diff --git a/docs/Installation.md b/docs/Installation.md index bf8c192..94df9a1 100755 --- a/docs/Installation.md +++ b/docs/Installation.md @@ -2,26 +2,28 @@ - [Installation](#installation) - [Configure QR Code Scanner](#configure-qr-code-scanner) - - [Build application](#build-application) + - [Build Application](#build-application) - [Download Repository](#download-repository) - [Build docker image](#build-docker-image) - [Upload Scanner App to the Industrial Edge Management](#upload-scanner-app-to-the-industrial-edge-management) - [Connect your Industrial Edge App Publisher](#connect-your-industrial-edge-app-publisher) - [Upload Scanner App using the Industrial Edge App Publisher](#upload-scanner-app-using-the-industrial-edge-app-publisher) - - [Configuring application](#configuring-application) - - [Create \& Deploy configuration file](#create--deploy-configuration-file) - - [Configuration via template file](#configuration-via-template-file) + - [Configuring Application](#configuring-application) + - [Create & Deploy Configuration File](#create--deploy-configuration-file) + - [Configuration via Template File](#configuration-via-template-file) - [Configuration via JSON Schema UI](#configuration-via-json-schema-ui) ## Configure QR Code Scanner -The application is designed for checking for the **enter** character as suffix of the scanned code. The scanner can be configured to add this suffix after each scanned code by scanning the following QR Code. After detecting the suffix character the scanned code is published to the Databus and sent to the PLC using the OPC UA Connector. +The Siemens MV 320 QR code scanner can be configured by scanning specific QR codes. This application is designed for checking for the **enter** character as suffix of the scanned code. To configure the scanner to add this suffix after each scanned code scan the following QR code. -**Scan to configure the enter suffix:** +After detecting the suffix character the scanned code is published to the Databus and sent to the PLC using the OPC UA Connector. + +**Scan to configure the Enter suffix:** ![deploy VFC](graphics/suffix.png) -## Build application +## Build Application ### Download Repository @@ -39,9 +41,9 @@ git clone https://github.com/industrial-edge/qr-code-scanner.git ![VS Code Git Clone command](graphics/git.png) -### Build docker image +### Build Docker Image -- Navigate into `src` and find the file named `Dockerfile.example`. The `Dockerfile.example` is an example Dockerfile that can be used to build the docker image(s) of the service(s) that runs in this application example. If you choose to use these, rename them to `Dockerfile` before proceeding +- Navigate into `src` and find the file named `Dockerfile.example`. The `Dockerfile.example` is an example Dockerfile that can be used to build the docker image(s) of the service(s) that runs in this application example. If you choose to use this example file, rename it to `Dockerfile` before proceeding - Open a console in the root folder (where the `docker-compose` file is) - Use the `docker compose build` (replaces the older `docker-compose build`) command to build the docker image of the service which is specified in the docker-compose.yml file. - These Docker images can now be used to build your app with the Industrial Edge App Publisher @@ -49,27 +51,29 @@ git clone https://github.com/industrial-edge/qr-code-scanner.git ## Upload Scanner App to the Industrial Edge Management -Please find below a short description how to publish your application in your IEM. +Please find below a short description how to publish your application to your IEM. For more detailed information please see the section for [uploading apps to the IEM](https://github.com/industrial-edge/upload-app-to-iem). ### Connect your Industrial Edge App Publisher -- Connect your Industrial Edge App Publisher to your docker engine +- Connect your Industrial Edge App Publisher to your Docker engine - Connect your Industrial Edge App Publisher to your Industrial Edge Management System ### Upload Scanner App using the Industrial Edge App Publisher -- Create a new application using the Industrial Publisher -- Add a app new version -- Import the [docker-compose](../docker-compose.yml) file using the **Import YAML** button +- Click on "Create Project" in the App Project region (you will be redirected to the IEM) +- Create a new project with "Create Project" in the top right corner or use an existing project +- Create an application +- Go back to the Industrial Edge Publisher, refresh the app projects, select the application and add a new app version +- Import the [docker-compose](../docker-compose.yml) file using the "Import YAML" button - The warning `Build (services >> scanner-service) is not supported` can be ignored -- **Start Upload** to transfer the app to Industrial Edge Management +- "Start Upload" to transfer the app to Industrial Edge Management - Further information about using the Industrial Edge App Publisher can be found in the [IE Hub](https://iehub.eu1.edge.siemens.cloud/documents/appPublisher/en/start.html) -## Configuring application +## Configuring Application -You can find the configuration file ["param.json"](../cfg-data/param.json) in cfg-data folder. This configuration file can be used adjust several parameters of this application. You can see the structure of the file in the following example configuration: +You can find the configuration file [param.json](../cfg-data/param.json) in cfg-data folder. This configuration file can be used to adjust several parameters of this application. You can see the structure of the file in the following example configuration: **param.json:** @@ -81,7 +85,7 @@ You can find the configuration file ["param.json"](../cfg-data/param.json) in cf "Password": "edge", "Metadata": "ie/m/j/simatic/v1/opcuac1/dp", "Topic": "ie/d/j/simatic/v1/opcuac1/dp/w/PLC_OPC", - "Variable": "GDB_appSignals_APP_QRCode" + "Variable": "GDB.appSignals.APP_QRCode" } ``` @@ -95,53 +99,61 @@ You can find the configuration file ["param.json"](../cfg-data/param.json) in cf Adjust the configuration file depending on your needs. -## Create & Deploy configuration file +## Create & Deploy Configuration File The system offers several possibilities configuring your application. The following steps describes two available options: - Configuring via [Template File](#configuration-via-template-file) - Configuring via [JSON Schema UI](#configuration-via-json-schema-ui) -### Configuration via template file +### Configuration via Template File -Once you have successfully uploaded the QR Code Scanner application to your IEM you need to add the [configuration file](../cfg-data/param.json) to your application. You can either choose between version and non versioned configuration files. The non version configuration file will be described in the next steps. -Go to **Applications/ My Projects** and open the QR Code Scanner application. Here you can create a new configuration file. +Once you have successfully uploaded the QR code scanner application to your IEM you need to add the [configuration file](../cfg-data/param.json) to your application. You can either choose between version and non versioned configuration files. The non version configuration file will be described in the next steps. +Go to "App Projects", select your project and open your QR code scanner application. Here you can create a new configuration file. **Add Configuration:** +Click on "Configurations" and in the upcoming window "Add Configuration". ![deploy VFC](./graphics/add_config_file.png) **Configure Configuration:** ![deploy VFC](./graphics/configure_config.png) -**Deploy application with configuration file:** +Make sure to use this [configuration file](../cfg-data/param.json). -During the deploying process of the application you need to select the configuration file, if needed you can adapt the configuration file before deploying. +**Deploy Application with Configuration File:** -**Deploy Application:** +During the deploying process of the application you need to select the configuration file you just created. ![deploy VFC](./graphics/deploy_config.png) ### Configuration via JSON Schema UI +Using the JSON schema option the application can be configured via a graphical UI during the download of the application to the edge device or when updating the configuration. All needed parameters can be configured here. You need to use this [configuration file](../cfg-data/json_schema/param.json) for this method. -Using the JSON Schema option the application can be configured via graphical UI during downloading of the application. All needed parameters can be configured in the UI: - -**Configure application:** - -![schema](./graphics/json_schema_ui.png) +**Adjust App Settings:** -**Add Configuration:** +Before uploading the JSON schema you need to enable an external configurator first: -Before [uploading](#upload-scanner-app-to-the-industrial-edge-managment) the application with the Industrial Edge Publisher you can add the JSON Schema via the **"+Configurations"** button. Add a new configuration (in the IE Publisher), select the JSON Schema option and upload the [JSON Schema file](../cfg-data/json_schema/). +![schema redirect](./graphics/json_schema_configuration_prerequisite.png) **Add JSON Schema:** +Go back to the overview of the app, click on "Configurations" and in the upcoming window "Add Configuration". + ![json_configuration](./graphics/json_schema_configuration.png) -During downloading of the QR Code Scanner application you can now select the added JSON Schema and configure the application via the configuration UI. +Make sure to use the correct [configuration file](../cfg-data/json_schema/param.json). + +**Configure Application:** + +As soon as you deploy the application (or if updating the configuration) you can now adjust the configuration: + +![schema](./graphics/json_schema_ui.png) + +Before clicking Next make sure to have checked the checkmark at the top left hand corner. -**Additional information:** +**Additional Information:** Further information about creating your own JSON Schema UI can be found: diff --git a/docs/PLC_connection.md b/docs/PLC_connection.md index 3e611f4..3bc7e07 100755 --- a/docs/PLC_connection.md +++ b/docs/PLC_connection.md @@ -1,6 +1,6 @@ # Configure OPC UA Connection -After the scanning event the code should be sent to the PLC using the OPC UA Connector. For doing this the OPC UA Connector as well as the Databus needs to be configured properly. +After scanning a QR code its content should be sent to the PLC using the OPC UA Connector. Therefore the OPC UA Connector as well as the Databus need to be configured properly. - [Configure OPC UA Connection](#configure-opc-ua-connection) - [Configuring Databus](#configuring-databus) @@ -9,9 +9,11 @@ After the scanning event the code should be sent to the PLC using the OPC UA Con ## Configuring Databus Create the topic in your Databus, which allows you to write to PLCs. -The corresponding Databus topic for writing to your PLC looks like this: ie/d/j/simatic/v1/opcuac1/dp/w/# -Additionally the meta data topic ie/m/# needs to be configured, which is required for properly configure the MQTT connection inside of the application.
-Using the wildcard sign **#** you have access to all configured connections. +The corresponding Databus topic for writing to your PLC through the OPC UA Connector looks like this: ie/d/j/simatic/v1/opcuac1/dp/w/# + +Additionally, the meta data topic ie/m/# needs to be accessible, which is required to properly configure the MQTT connection inside the application. + +Using the wildcard sign **#** you have access to all topics. A user with access to the ie/# topic can therefore access all required topics. ![deploy VFC](./graphics/databus_config.png) diff --git a/docs/graphics/add_config_file.png b/docs/graphics/add_config_file.png index 61c238d..1330c49 100755 Binary files a/docs/graphics/add_config_file.png and b/docs/graphics/add_config_file.png differ diff --git a/docs/graphics/configure_config.png b/docs/graphics/configure_config.png index 84d90f6..5153ebc 100755 Binary files a/docs/graphics/configure_config.png and b/docs/graphics/configure_config.png differ diff --git a/docs/graphics/databus_config.png b/docs/graphics/databus_config.png index 5677d88..4203a35 100755 Binary files a/docs/graphics/databus_config.png and b/docs/graphics/databus_config.png differ diff --git a/docs/graphics/deploy_config.png b/docs/graphics/deploy_config.png index f7fa2fe..d7c408d 100755 Binary files a/docs/graphics/deploy_config.png and b/docs/graphics/deploy_config.png differ diff --git a/docs/graphics/json_schema_configuration.png b/docs/graphics/json_schema_configuration.png index 88ceecf..a150c81 100755 Binary files a/docs/graphics/json_schema_configuration.png and b/docs/graphics/json_schema_configuration.png differ diff --git a/docs/graphics/json_schema_configuration_prerequisite.png b/docs/graphics/json_schema_configuration_prerequisite.png new file mode 100644 index 0000000..e2ec20e Binary files /dev/null and b/docs/graphics/json_schema_configuration_prerequisite.png differ diff --git a/docs/graphics/json_schema_ui.png b/docs/graphics/json_schema_ui.png index f6db516..ab11cdd 100755 Binary files a/docs/graphics/json_schema_ui.png and b/docs/graphics/json_schema_ui.png differ diff --git a/docs/graphics/opcua_config.png b/docs/graphics/opcua_config.png index d0d1ebb..c05d0c7 100644 Binary files a/docs/graphics/opcua_config.png and b/docs/graphics/opcua_config.png differ diff --git a/src/main.py b/src/main.py index 4d5d480..81a01c5 100755 --- a/src/main.py +++ b/src/main.py @@ -1,8 +1,8 @@ # QR Code Scanner App, which sends scanned QR Code to PLC -# Copyright 2020 Siemens AG +# Copyright 2023 Siemens AG # This file is subject to the terms and conditions of the MIT License. # See LICENSE file in the top-level directory. -# Date: 05.05.2021 +# Date: 22.12.2023 import paho.mqtt.client as mqtt from createDict import getDict @@ -26,7 +26,7 @@ class mqttclient: """ mqttclient access the IE-Databus and - returns the Metadata from the dedicated connection of the S7 Connector + returns the Metadata from the dedicated connection of the OPCUA Connector """ @@ -36,7 +36,7 @@ def __init__(self,clientname,broker, user, password, topic, plc_connection): # Initialize dictionary for Metadata self.IDDict = {} - # IE Databus and S7 Connector information + # IE Databus and OPCUA Connector information self.broker = broker self.mqtt_user = user self.mqtt_password = password @@ -56,7 +56,7 @@ def on_message(self, client, userdata, message): self.IDDict = getDict(msg, self.plc_connection) print("INFO | New message received: " + msg) - print("INFO | Extracted dict: " + self.IDDict) + print("INFO | Extracted dict: " + str(self.IDDict)) sys.stdout.flush() def on_connect(self, client, userdata, flags, rc): @@ -148,7 +148,7 @@ def read_parameter(jsonfile): # Check for QRCode suffix if event.code == CONST_ENTER: - # Copy barcode to S7 Connector topic + # Copy barcode to OPCUA topic PLC_QR_Code['vals'][0]['id'] = (my_mqtt_client.IDDict.get(params['Variable'])) PLC_QR_Code['vals'][0]['val'] = barcode # Publish MQTT Topic and flush to logs