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.
Successfully connected HighByte Intelligence Hub to Unity3D with SparkplugB! ✔
👀 I am sending data from my Automation-Gateway.com 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…
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 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.
In this tutorial, I will guide you through the essential steps to set up the Automation Gateway, harness the power of YAML extensions in Visual Studio Code for configuration, and connect various devices, including OPC UA, MQTT, and PLC4X devices. I will show how to integrate the values from the devices to the Gateway’s OPC UA server and how to use the MQTT interface to get the values from the devices via a MQTT client. Additionally values from the connected devices will be logged to a Influx database.
I wanted to get my Home-Automation values to SCADA, it’s a “self-made” JSON message format. I tried it with Ignition and the MQTT Module. Btw.: it’s great that they have the Makers Edition for non-commercial use at home 👍. But I don’t know why, it only got one topic and one value from my MQTT Broker, and it did not receive any updates. Don’t know what went wrong…
Anyhow, I decided to add a custom JSON format to the Automation-Gateway.com. It’s simple, just define the JSON-Path to the value and optionally to a timestamp in milliseconds since epoch or to an ISO 8601 format.
Now I can use the Automation-Gateway’s OPC UA server in any SCADA system to visualize my MQTT values…
Here is the config.yaml configuration file for the Automation-Gateway.
🤔 I thought about if it could make sense to connect to a MQTT broker and write the topic-path in a structured and connected way to a graph database. It could reflect a companies UNS with ISA structure in a graph with query possibilities.
🤝 The UNS could be enriched by adding additional meta information to the database and be linked to the MQTT nodes. Graph queries could be used to combine the enriched data with the current values of the machines…
👉 I reactivated the Neo4J Logger in the Automation-Gateway.com, and enabled MQTT for it. It creates the nodes in a neo4j graph database based on the incoming MQTT messages.