๐ŸŒณ Views / Virtual Topic Trees in MonsterMQ Edge!

One thing has always bothered me about MQTT in practice: devices publish where they want to, for example: tasmota/devices/14835A/...

The device ID is in there, fine. But every time I want to query or subscribe to that sensor, I first have to look up what device 14835A actually is. Is it my living room or is it the kitchen? Is it a temp sensor? Or is it a power meter?

With virtual topics, you can now define views on top of real topics. The sensor above can also be made available as: austria/vogler/office/temperature/..

Same data, two (or more) names. No republishing, no copying, no duplicated messages.

  • ๐Ÿ‘‰ Map a single topic, or mount a whole subtree
  • ๐Ÿ‘‰ Wildcard subscriptions work on the virtual tree
  • ๐Ÿ‘‰ Each node is read-only or read-write

That way you can have a location view, an asset view, or an ISA-95 style view of the same devices, all at the same time.

Now my question to you: is this useful, or should I drop it again? How do you deal with this today? Republishing in Node-RED, a strict UNS naming convention from day one, or just an Excel sheet? ๐Ÿ˜‰

1793791980848

MonsterMQ Edge available for Siemens WinCC Unified Comfort Panels!

Vacation day ๐Ÿ๏ธ I have published the MonsterMQ Edge MQTT Broker as an Industrial Edge app, bringing a lightweight, single-binary MQTT broker directly to your SIMATIC WinCC Unified Comfort Panels with a data connection to the runtime data.

### โšก Quick 4-Step Setup:
1. Download: Grab MonsterMQ-Edge.tar from MonsterMQ-Edge GitHub Releases https://github.com/vogler75/monster-mq-edge/releases

2. Rename: Change the file extension from .tar to .app (MonsterMQ-Edge.app).

3. Upload & Start: Upload the .app file directly to your panel (with Industrial Edge enabled) and launch it.

4. Configure: Connect and manage the broker using the MonsterMQ Dashboard app, available under releases at MonsterMQ GitHub https://github.com/vogler75/monster-mq/releases

See how you can configure the HMI Tags to be exposed via MQTT
๐Ÿ‘‰ https://youtu.be/C9KdrntWjec

โš ๏ธ Use “/tmp/automation/HmiRuntime” as the Pipe Path!

#Siemens #WinCCUnified #IndustrialEdge #MQTT #MonsterMQ #IIoT #IndustrialAutomation #EdgeComputing

Monster-Edge-Panel-1
Monster-Edge-Panel-2
Monster-Edge-Panel-3
Monster-Edge-Panel-4
Monster-Edge-Panel-5
Monster-Edge-Panel-6
Monster-Edge-Panel-7
Monster-Edge-Panel-8

MonsterMQ ๐ŸงŒ Clustering for Industrial IoT

Did you know that MonsterMQ includes clustering capabilities?

๐Ÿ‘€ Multiple broker instances can form a cluster, building a distributed system.

See this LinkedIn post for a video.

Hereโ€™s an high-level example:
๐Ÿ‘‰ Each production line can run its own broker instance, keeping high data loads local.
๐Ÿ‘‰ A site-level broker aggregates higher-level metrics like OEE or production summaries.

๐Ÿ’ช With MonsterMQ, production line brokers remain independent – if one goes down, the others are unaffected. Yet, cross-line data access is seamless. For example, one line can subscribe to another’s current production order or OEE. Only relevant data is transmitted between brokers, reducing overhead.

๐Ÿ’ช Clustering is powered by Hazelcast, with communication handled by Vert.X.

โš ๏ธ Since MonsterMQ relies on a central #PostgreSQL database, this creates a central point of failure. To mitigate this, the PostgreSQL database must be made high available. Alternatively, you can use a clustered #CrateDB, which allows you to deploy one database node on each MonsterMQ node for improved resilience. Currently subscriptions are stored in memory on all nodes, which restricts scalability, but for factory use-cases it should not matter.

Replicate and Archive Data from a MQTT Broker to MonsterMQ

Hereโ€™s a straightforward example of how data replication can be achieved using the Frankenstein Automation-Gateway.com to transfer data from a remote broker to a local MonsterMQ Broker.

The local MonsterMQ Broker is configured so that data is stored in TimescaleDB to maintain a historical record. This process converts the current state of the UNS into archived historical data.

It will also create a Frankenstein OPC UA Server, allowing you to access the data from the MQTT broker. However, since we have it data-agnostic, all the data in the OPC UA Server will be available as a string data type.

Monster.yaml

Create a file monster.yaml with this content :

TCP: 1883 
WS: 1884
SSL: false
MaxMessageSizeKb: 64
QueuedMessagesEnabled: false

SessionStoreType: POSTGRES
RetainedStoreType: POSTGRES

ArchiveGroups:
  - Name: "source"
    Enabled: true
    TopicFilter: [ "source/#" ]
    RetainedOnly: false
    LastValType: NONE
    ArchiveType: POSTGRES

Postgres:
  Url: jdbc:postgresql://timescale:5432/postgres
  User: system
  Pass: manager

Frankenstein.yaml

Create a file frankenstein.yml with this content and adapt the Host of the soruce broker and the Topic paths which you want to replicate from the source to your local MonsterMQ Broker.

Servers:
  OpcUa:
    - Id: "opcsrv"
      Port: 4840
      EndpointAddresses:
        - linux0 # Change this to your hostname!
      Topics:
        - Topic: mqtt/source/path/Enterprise/Dallas/#
Drivers:
  Mqtt:
    - Id: "source"
      Enabled: true
      LogLevel: INFO
      Host: test.monstermq.com # Change this to your source MQTT Broker!
      Port: 1883
      Format: Raw
Loggers:
  Mqtt:
    - Id: "source"
      Enabled: true
      LogLevel: INFO
      Host: 172.17.0.1
      Port: 1883
      Format: Raw
      BulkMessages: false
      LogLevel: INFO
      Logging:
        - Topic: mqtt/source/path/Enterprise/Dallas/#

Docker Compose

Create a docker-compose.yaml file with this content and then start it with docker-compose up -d

services:
  timescale:
    image: timescale/timescaledb:latest-pg16
    container_name: timescale
    restart: unless-stopped
    ports:
      - "5432:5432"
    volumes:
      - timescale_data:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: system
      POSTGRES_PASSWORD: manager
  monstermq:
    image: rocworks/monstermq:latest
    container_name: monstermq
    restart: unless-stopped
    ports:
      - 1883:1883
      - 1884:1884
    volumes:
      - ./log:/app/log
      - ./monster.yaml:/app/config.yaml
    command: ["+cluster", "-log FINE"]
  frankenstein:
    image: rocworks/automation-gateway:1.37.1
    container_name: frankenstein
    restart: always
    ports:
      - 1885:1883
      - 4840:4840
    environment:
      JAVA_OPTS: '-Xmx1024m'
    volumes:
      - ./frankenstein.yaml:/app/config.yaml
      - ./security:/app/security
volumes:
  timescale_data:      

MonsterMQ with Grafana

Because MonsterMQ can store topic values directly in PostgreSQL/Timescale, you can instantly create dashboards with Grafana! ๐Ÿ“Š

Hereโ€™s a simple example:

๐Ÿ‘‰ Check out the live dashboard

Itโ€™s super easy to get started. Use the public available MonsterMQ at test.monstermq.com at port 1883. Just publish a JSON string to any topic under “Test”, like “Test/Sensor1” with a payload like this: {“value”: 1}, and youโ€™ll see the value reflected in the Grafana dashboard in real time.

Iโ€™m currently publishing temperature sensor values to the public broker from my home automation using automation-gateway.com. Just that you see some values in the dashboard.

So, if you need a broker to store your IoT data directly into TimescaleDB without the need for any additional components, consider using MonsterMQ. It’s free and available at MonsterMQ.com.

Here is the exmaple docker-compose.yml file of the public availble test.monstermq.com broker:

services:
  timescale:
    image: timescale/timescaledb:latest-pg16
    restart: unless-stopped
    ports:
      - "5432:5432"
    volumes:
      - /data/timescale:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: system
      POSTGRES_PASSWORD: xxx
  monstermq:
    image: rocworks/monstermq:latest
    restart: unless-stopped
    ports:
      - 1883:1883
    volumes:
      - ./config.yaml:/app/config.yaml
    command: ["+cluster", "-log INFO"]
  pgadmin:
    image: dpage/pgadmin4
    restart: unless-stopped
    environment:
      PGADMIN_DEFAULT_EMAIL: andreas.vogler@rocworks.at
      PGADMIN_DEFAULT_PASSWORD: xxx
    volumes:
      - /data/pgadmin:/var/lib/pgadmin/storage
    ports:
      - "8080:80"
  grafana:
    image: grafana/grafana
    restart: unless-stopped
    ports:
    - 80:3000

Here is the MonsterMQ config.yml file:

Port: 1883
SSL: false
WS: true
TCP: true

SessionStoreType: POSTGRES
RetainedStoreType: POSTGRES

SparkplugMetricExpansion:
  Enabled: true

ArchiveGroups:
  - Name: "All"
    Enabled: true
    TopicFilter: [ "#" ]
    RetainedOnly: false
    LastValType: POSTGRES
    ArchiveType: NONE
  - Name: "Test"
    Enabled: true
    TopicFilter: [ "Test/#" ]
    RetainedOnly: false
    LastValType: NONE
    ArchiveType: POSTGRES

Postgres:
  Url: jdbc:postgresql://timescale:5432/monster
  User: system
  Pass: xxx

Give it a try and let me know what you think!

#iot #mqtt #monstermq #timescale #postgresql #grafana

Publish OPC UA and MQTT Data to the Cloud with Automation-Gateway

Publish OPC UA and MQTT Data to the Cloud with Automation-Gateway – inspired by a users request ๐Ÿ’ก

If you have a local ๐—ข๐—ฃ๐—– ๐—จ๐—” server or ๐— ๐—ค๐—ง๐—ง broker and want to bring that data to a ๐—ฐ๐—น๐—ผ๐˜‚๐—ฑ-๐—ฏ๐—ฎ๐˜€๐—ฒ๐—ฑ dashboard, Automation-Gateway.com makes it simple. You can easily publish your data to ๐—œ๐—ป๐—ณ๐—น๐˜‚๐˜…๐——๐—• Cloud and visualize it in ๐—š๐—ฟ๐—ฎ๐—ณ๐—ฎ๐—ป๐—ฎ โ€” all without complex setups.

I recently added support for InfluxDB V2 to the gateway, allowing you to configure an Influx token and bucket for data publishing. With just a few steps, your local OPC UA or MQTT data can be ๐˜€๐˜๐—ผ๐—ฟ๐—ฒ๐—ฑ ๐—ถ๐—ป ๐˜๐—ต๐—ฒ ๐—ฐ๐—น๐—ผ๐˜‚๐—ฑ and displayed in Grafana in real time.

MQTT Server Interface for WinCC OA? Made with Kotlin ๐Ÿ˜ฒ


Starting with WinCC OA Version 3.20, you can write your business logic in JavaScript and run them using Node.js, providing direct access to the WinCC OA Runtime.

๐Ÿ™ˆ With that, I have developed a Kotlin program that acts as an MQTT Broker. When you subscribe to a topic (where the topic name matches a datapoint name), the program will send value changes from the corresponding WinCC OA datapoint to your MQTT client.

โ“ But wait, Kotlin is like Java, it runs on the JVM, it is not JavaScript!

๐Ÿ’ก Did you know that a Node.js Runtime built with GraalVM exists? It allows you to mix Java and JavaScript. And it also works with WinCC OA.

๐Ÿคฉ You can use JVM based languages and its huge ecosystem to develop business logic with WinCC OA. I have developed a Java library which makes it easier to use the WinCC OA JavaScript functions in Java.

๐Ÿ‘‰ Here it is: https://github.com/vogler75/winccoa-graalvm please note that the example program is provided as an example; it lacks security features and has not been tested for production use. However, it can be extended and customized to meet specific requirements.

โšก Please be aware that the GraalVM Node.js Runtime is not officially supported by WinCC Open Architecture.

Zenoh & Automation-Gateway.com

OPC UA data to Zenoh? Have you ever used zenoh.io? Itโ€™s really cool.

๐Ÿ‘‰ I have implemented a Zenoh publisher in my fun open-source project, the Automation-Gateway.com. It can now bring data from OPC UA/MQTT/PLC4X to Zenoh, with just some lines of configuration.

๐Ÿ˜Ž The cool point about Zenoh is that you publish the data from multiple sources, from multiple machines to the data centric Zenoh network โ€“ there is no central server. You can then startup a Zenoh client somewhere and subscribe to data coming from any of those sources.

๐Ÿคซ It is like a distributed UNS.

๐Ÿคฉ And there is even more, they have a Zenoh MQTT bridge, so MQTT clients can connect to this bridge and subscribe to all the available data in the Zenoh network. A new machine/HMI/publisher can be added on the fly and the data will be visible immediately in the Zenoh MQTT bridge.

๐Ÿ‘‰ See the screenshots. I deployed the gateway to two machines to publish data from a S7 and from a WinCC OA system to the Zenoh network. Then I started a Zenoh MQTT bridge to subscribe to some of the data with a MQTT client.

๐Ÿค  Disclaimer: I did not take care about security. I did not do any performance tests.

WinCC Open Architecture Custom UNS Publisher

I’ve created a quick video demonstrating how simple it is to publish data from WinCC Open Architecture in a customized way to a UNS/MQTT broker.

๐Ÿ’ก With the new WinCC OA JavaScript Manager, it takes less than 60 lines of code!

๐Ÿ‘‰ You will find the example code here: https://lnkd.in/dwRRkmNH

There is nothing more to say, because it’s so easy… boring ๐Ÿฅฑ