WinCC OA & Node-Red Integration

It is very easy to get data from WinCC Open Architecture to NodeRed.

Add a new user to WinCC OA – System Management / Permission / User Administation.

We will use “node” as username.

Add Config Entry

httpsPort = 8449
resourceName = "/websocket"

Start Control Manager “wss.ctl -user <username>:” Note the trailing “:” !!

wss.ctl -user node:

Node-Red: Install Palette “node-red-contrib-winccoa”

You can now add a Node. In that example we will use the dpQuery node and use “SELECT ‘_online.._value’ FROM ‘Meter_Input_WattAct.'” as query. So we just query the online value of one tag.

You have to configure the Server by clicking on the pencil button. This points to the before started Websocket Control Manager and you have to set the username and password we have added in one of the previous steps.

OPC UA Node Tree to MQTT

With just 20 lines of configuration you can publish a OPCUA tree of values to MQTT …

in this example to the HiveMQ cloud … 👉 with the

It also supports PLC4x connected devices/plcs…

It can also publish values to Kafka or SQL databases…

git clone
cd source\app
set GATEWAY_CONFIG=configs/config-opcua-mqtt.yaml
gradle run

  - Id: "demo"
    Enabled: true
    LogLevel: INFO
    EndpointUrl: "opc.tcp://"
    UpdateEndpointUrl: true
    - Id: mqtt1
      Enabled: true
      Host: linux0.rocworks.local
      Port: 1883
      Ssl: false
      Topic: Enterprise/Site
        - Topic: opc/demo/path/Objects/Demo/SimulationMass/#

Missing UnityEngine.UI

If you are getting the following error while opening a Untiy project:

unity error CS0234: The type or namespace name 'UI' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)

Then you just need to add the “Unity Ui” Package in the Unity Package manager.

Embed Grafana in WinCC Unified

In this scenario we will host Grafana over the IIS from WinCC Unified. So that it comes from the same origin and that we do not come over a CORS (Cross-Origin Request Blocked) problem.

What is needed to allow Grafana to be embedded in another application is to set allow_embedding = true in the Grafana configuration file.

To host Grafana over the IIS the following settings must be made:

Add a URL Rewrite to your IIS configuration file. Change “desktop-khlb071” to your computer where Grafana is running on. Restart the Webpage with the IIS Manager.

The IIS configuration file can be found here: (C:\Program Files\Siemens\Automation\WinCCUnified\SimaticUA\web.config)

                <rule name="grafana" enabled="true" stopProcessing="false">
                    <match url="grafana(/)?(.*)" ignoreCase="true" />
                    <action type="Rewrite" url="http://desktop-khlb071:3000/{R:0}" appendQueryString="true" logRewrittenUrl="false" />

Change the following configuration of Grafana (defaults.ini). Change the domain to your computer name where Grafana is running on. It must be the same name what you use in the IIS configuration file!

# The public facing domain name used to access grafana from a browser
domain = desktop-khlb071

# Redirect to correct domain if host header does not match domain
# Prevents DNS rebinding attacks
enforce_domain = false

# The full public facing url
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana

# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons.
serve_from_sub_path = true

# set to true if you want to allow browsers to render Grafana in a <frame>, <iframe>, <embed> or <object>. default is false.
allow_embedding = true

Bringing PLC values to OPC UA, MQTT, GraphQL

With just some lines of configuration you can bring PLC values to OPC UA, MQTT and GraphQL. And to a variety of databases for tag logging…

💡 In that example with ModBus, but thanks to #plc4x this should work in the same way also for the other protocols supported by PLC4X.

📺 See the video, ModBus values are brought to OPC UA and MQTT.

💣 In MQTT the topic name is enriched with a UNS ISA95 topic path.

⚡ On MQTT SparkplugB encoded messages could be used.

😎 100% GUI free and Open Source.


    - Port: 4000
      LogLevel: INFO
      GraphiQL: true

    - Port: 4841
      Enabled: true
      LogLevel: INFO      
        - Topic: plc/demo/node/holding-register:1:INT
        - Topic: plc/demo/node/holding-register:2:INT
        - Topic: plc/demo/node/holding-register:3:INT
    - Id: "demo"
      Enabled: true
      Url: "modbus://localhost:502"
        Time: 100
        OldNew: true
      WriteTimeout: 100
      ReadTimeout: 100
      LogLevel: INFO    

    - Id: mqtt1
      Enabled: true
      Port: 1883
      Topic: modbus
      Format: Raw
        - Topic: plc/demo/node/holding-register:1:INT
          Target: enterprise/area1/line1/cell1/speed
        - Topic: plc/demo/node/holding-register:2:INT
          Target: enterprise/area1/line1/cell1/power
        - Topic: plc/demo/node/holding-register:3:INT
          Target: enterprise/area1/line1/cell1/torque

TCP – MQTT – TCP Bridge

Some weeks ago, someone asked at the #HiveMQ Slack channel if there is any way to run SSH over MQTT…
👉 Strange idea? I liked it, and I want to share the TCP-MQTT-TCP bridge I made weeks ago. 
🤔 Use Case? Imagine you have IoT’s connected to a central MQTT broker and you want to connect from one to another via SSH, transfer files, expose services, a Webpage, without exposing ports to the public internet or creating a VPN. 
⚠️ Be careful and please evaluate and consider the possible security impacts before using this “backdoor man” … the doors …
⚠️ And transferring files over MQTT may increase your cloud bill 🤑 
👉It’s on  GitHub, it is just a draft and can be used as a template to be extended by your needs.  
👀 How to? Start the client.js script at the destination host – or more precisely at a node in the local network where the destination node runs – and start the server.js script on the source node from where you want to connect to the remote/destination host and port. For example, if there is a SSH server running on the destination host+port, then you can do a SSH localhost -p 8080 -l username at your source node, and you will get a SSH connection from the source node to the destination node. And the data is transmitted over MQTT topics. 

HighByte to Unity3D with SparkplugB

Successfully connected HighByte Intelligence Hub to Unity3D with SparkplugB! ✔

👀 I am sending data from my to the Intelligence Hub via OPC UA, then the values are published from HighByte to MQTT with the Intelligence Hub SparkplugB connector and then getting consumed in Unity with the MQTT SparkplugB Asset.

👍 Works straight forward and was easy to setup!

🧐 Sparkplug Learning: If a Host Application is not the Primary Host of an Edge Node and it starts up after the Edge Node, it must send the Rebirth command to the Edge Nodes in which it is interested in, to get a birth message with the current/initial values of all the metrics of the nodes. My Unity client ignores incoming metrics of DATA messages which it has not seen before in a BIRTH message…

UNS with WinCC Open Architecture?

Did you know that WinCC Open Architecture is “UNS READY”? 👍

And it even does not matter how your underlying tags are structured 😮

👉 You can create your own hierarchical view on tags which you want to publish to MQTT in a Unified Namespace!

👉 You can define a fully ISA 95 compliant view on top of your machine data!

Happy UNS Publishing with WinCC Open Architecture!

See the MQTT publisher at the WinCC Open Architecture Documentation

SparkplugB for Unity3D

Unlock the potential of industrial data from SparkplugB enabled devices, seamlessly integrated into Unity3D to build 3D applications?

Or start creating industry Apps for Apple’s Vision Pro with SparkplugB connectivity? 🕶️

💡 I completed a SparkplugB 🚀 implementation for Unity. The primary objective was to acquire a hands-on understanding of SparkplugB.

👉 You can find it for free on GitHub It’s made on top of the “MQTT for Unity” Asset.

Disclaimer: There is no assurance that I have captured all the rules within the extensive 140-page SparkplugB specification. While Unity supports visionOS, I have not conducted testing on this platform.

MQTT for Gaming?

MQTT for Multiplayer Games? I am not a Game-Developer and I do not know how they create multiplayer internet games. But I know that MQTT can be used for that. Why?

# IoT turns to IoP

MQTT is used for connecting devices. Think about using MQTT for connecting players. “Internet of Things” (IoT) will turn to „Internet of Players“ (IoP).

# A Player is like a Device?

In a multiplayer game, each player is like a device. When they join the game, it’s like they’re saying “Hello, I’m here!” to everyone else – this is known as a “birth message” in MQTT terms.

# Sharing Information Seamlessly

As players move around in the game, they keep sending updates like their location, healthy state, collected goodies, …. MQTT acts like a messenger, picking up this information and delivering it to everyone else playing. 

# Handling Player Exits

What if a player leaves the game intentionally or unintentionally? MQTT has a smart feature called “last will message.” It’s like a goodbye note that tells other players someone has left the game. This way, everyone stays in the loop.

# Central Management 

A central game management connected to the central MQTT broker, written in any kind of language, could be used to observe and control the game and all the players.

# Why MQTT?

1. **Real-Time Updates**: It’s fast and perfect for real-time games.

2. **Reliable**: Even if a player’s connection is shaky, MQTT makes sure messages get through.

3. **Efficient**: It doesn’t eat up much data, so players won’t lag.

4. **Simple**: It’s not complicated to set up and to use.

# Conclusion

Using MQTT in multiplayer games is like having a super-efficient mailman who ensures everyone knows what’s happening as it happens.

For Unity there is a „Unity for MQTT“ and a “GraphQL for Unity Pro” asset. Easy to use and usable with all the main build targets, including WebGL!

See the game demo I made with MQTT. I also integrated data from WinCC Unified in the demo, with the GraphQL for Unity Pro Asset.

You can try it out: (could be already removed when you try to access it)