User Tools

Site Tools


glomus_mqtt_integration

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
glomus_mqtt_integration [2026/10/03 15:54] – [MQTT] kalaschnikowglomus_mqtt_integration [2026/10/08 16:48] (current) – [Certificates / SSL etc] kalaschnikow
Line 1: Line 1:
 +====== Glomus MQTT integration ======
  
 +
 +===== Plan =====
 +
 +  * Make TLS/SSL work
 +    * current problem: "No subjectAltNames on the certificate match"
 +  * ...
 +
 +===== Platforms for tests =====
 +
 +==== Kilo ====
 +
 +https://app.kiloiot.io
 +
 +User: kalaschnikow@mail.ru
 +
 +Pass: kiloYA..."6
 +
 +  * MQTT connector
 +    * Broker URL: <code>mqtts://mqtt-iot.kiloiot.io:1884</code>
 +    * Topic prefix: iot/8d3bccea-df38-4874-b70a-00c17d6a4e15/95f199fa-ba9c-4dee-9d61-9b656620ef9b
 +      * If device name is "device1", then topic name is:
 +        * iot/8d3bccea-df38-4874-b70a-00c17d6a4e15/95f199fa-ba9c-4dee-9d61-9b656620ef9b/device1
 +    * Username: mqtt_95f199fa
 +    * Password: wfqY73FTLfzZ3qT9Mdg66guLGWNdV0bY
 +
 +  * Working "MQTT Settings" for MQTTX (as of 08.10.2026)
 +    * MQTT version:
 +      * 5.0 
 +      * 3.1 - worked too (?)
 +    * SSL / TLS: true
 +    * Host: mqtt-iot.kiloiot.io
 +    * Port: 1884
 +    * Client ID: device1
 +    * User Name: mqtt_95f199fa
 +    * Password: wfqY73FTLfzZ3qT9Mdg66guLGWNdV0bY
 +    * Topic: iot/8d3bccea-df38-4874-b70a-00c17d6a4e15/95f199fa-ba9c-4dee-9d61-9b656620ef9b/device1
 +    * Data sent: <code>
 +{"msg": "msg_20260821102105","lat": 49.04223684221506,"lon": 8.722192514687777}
 +</code>
 +
 +  * Working "MQTT Settings" for Glomus app (as of 08.10.2026)
 +    * MQTT version:
 +      * 5.0 
 +    * SSL / TLS: true
 +    * Host: mqtt-iot.kiloiot.io
 +    * Port: 1884
 +    * Client ID: device1
 +    * User Name: mqtt_95f199fa
 +    * Password: wfqY73FTLfzZ3qT9Mdg66guLGWNdV0bY
 +    * Topic: iot/8d3bccea-df38-4874-b70a-00c17d6a4e15/95f199fa-ba9c-4dee-9d61-9b656620ef9b/device1
 +    * Data sent: <code>
 +{"msg": "msg_20260821102105","lat": 49.04223684221506,"lon": 8.722192514687777}
 +</code>
 +
 +==== OpenRemote ====
 +
 +[[OpenRemote]]
 +
 +https://docs.openremote.io/docs/user-guide/domains/fleet-management/
 +
 +  * Working "MQTT Settings" for MQTTX (as of 02.10.2026)
 +    * MQTT version: 3.1
 +    * SSL / TLS: true
 +    * Host: awow2024
 +    * Port: 8883
 +    * Client ID: mqttx_aaf87899
 +    * User Name: master:mqttuser
 +    * Password: h0ZEXtVgEIf0xP1tLDweoU0l6PNuCpFf2GfGpm4rkpabcTdjnHOO174st79s7j1jScPEqsJxZfLk6jSwhAREL1
 +    * Topic: master/mqttx_aaf87899/writeattributevalue/location/5soNjlXan6x0U9i1hL2G6D
 +    * Data sent: <code>{
 +  "type": "Point",
 +  "coordinates": [
 +    8.72233, 
 +    49.042166
 +  ]
 +}</code>
 +
 +
 +==== Thinger.io ====
 +
 +https://docs.thinger.io/mqtt
 +
 +
 +==== ThingsBoard ====
 +
 +https://demo.thingsboard.io
 +
 +User: blubbsik@gmx.de
 +
 +Pass: thingsYA...
 +
 +
 +
 +A small "How To" by RouterOS: 
 +https://help.mikrotik.com/docs/spaces/ROS/pages/166920428/GPS-tracking+using+MQTT+and+ThingsBoard
 +===== Clients for tests =====
 +
 +  * MQTTX
 +    * CLI
 +    * UI App 
 +      * Ubuntu
 +      * Windows
 +      * ...
 +
 +===== Certificates / SSL etc =====
 +
 +Certificates are in ''/mnt/sda4/development/_projects/fleet-management/''
 +  * myclient.p12
 +    * PKCS#12 keystore 
 +  * myclient.pfx
 +    * key in pfx
 +  * myclient.pem
 +    * key in PEM
 +  * myclient.pubkey.pem
 +    * pubkey ?
 +
 +  * https://keystore-explorer.org
 +    * tool to create / export certificates etc
 +
 +A forum post (with example code?) that seems to be interesting:
 +https://community.hivemq.com/t/hivemq-client-mtls-is-failing/1548/2
 +
 +Example code from google:
 +<code>import com.hivemq.client.mqtt.MqttClient;
 +import com.hivemq.client.mqtt.mqtt5.Mqtt5BlockingClient;
 +
 +import javax.net.ssl.KeyManagerFactory;
 +import javax.net.ssl.TrustManagerFactory;
 +import java.io.FileInputStream;
 +import java.io.InputStream;
 +import java.security.KeyStore;
 +
 +public class MqttSslExample {
 +
 +    public static void main(String[] args) {
 +        try {
 +            // 1. Pfade und Passwörter definieren
 +            String truststorePath = "pfad/zu/client-truststore.jks";
 +            String truststorePassword = "truststore_passwort";
 +
 +            String keystorePath = "pfad/zu/client-keystore.p12"; // Oft PKCS12 (.p12/.pfx)
 +            String keystorePassword = "keystore_passwort";
 +
 +            // 2. TrustManagerFactory initialisieren (Zertifikat des Brokers validieren)
 +            KeyStore trustStore = KeyStore.getInstance("JKS"); // oder "PKCS12"
 +            try (InputStream tsIn = new FileInputStream(truststorePath)) {
 +                trustStore.load(tsIn, truststorePassword.toCharArray());
 +            }
 +            TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
 +            trustManagerFactory.init(trustStore);
 +
 +            // 3. KeyManagerFactory initialisieren (Eigenes Client-Zertifikat für mTLS - Optional)
 +            KeyStore keyStore = KeyStore.getInstance("PKCS12"); 
 +            try (InputStream ksIn = new FileInputStream(keystorePath)) {
 +                keyStore.load(ksIn, keystorePassword.toCharArray());
 +            }
 +            KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
 +            keyManagerFactory.init(keyStore, keystorePassword.toCharArray());
 +
 +            // 4. HiveMQ MQTT Client mit SSL-Konfiguration bauen
 +            Mqtt5BlockingClient client = MqttClient.builder()
 +                    .useMqttVersion5()
 +                    .serverHost("ihr-secure-broker.de")
 +                    .serverPort(8883)
 +                    .sslConfig()
 +                        .trustManagerFactory(trustManagerFactory) // Broker-Zertifikat prüfen
 +                        .keyManagerFactory(keyManagerFactory)     // Client-Zertifikat mitsenden (mTLS)
 +                    .applySslConfig()
 +                    .buildBlocking();
 +
 +            // Client verbinden
 +            client.connect();
 +            System.out.println("Erfolgreich über TLS verbunden!");
 +            
 +            client.disconnect();
 +
 +        } catch (Exception e) {
 +            e.printStackTrace();
 +        }
 +    }
 +}
 +
 +</code>
 +
 +Also interesting :
 +  * [[https://www.google.com/search?q=hivemq+MqttClientSslConfig+MqttClientSslConfigBuilder&client=ubuntu-sn&hs=mGM&sca_esv=eba56e73f2efc4d2&channel=fs&biw=1854&bih=935&sxsrf=APpeQns7j_e_NybNUqg6OjQBTiBvYK237A%3A1790942009644&ei=yZq_aqaxGbiFxc8PybWw0Aw&uact=5&sclient=gws-wiz-serp&udm=50&fbs=ABfTbFUyxjQn9bne4DuflY2dNqqKupTsDwp6RXwpQFJxPysO9IZ-OcP6xq64A4yNP8lBdpbTupudBqidne2pweOCd3nKfqn6uS_Gge1dCYX0Ms3qGsMNXmb74m-lLxkHoaJpatWR_E9rM8U216_FCBt3UIuJg8mmmj_iBydLNAHjsg3OjGr2pqkfpIaLayx7usdCgVt3V6oN&aep=10&ntc=1&mstk=AUtExfDS3sxvOsPda2QvrC3f-PYqOWMx8eEHAl2qAPrnEOf18nOOhnYnS_ds6jz5t1yVbxuw1wp4axO48e41u73Q5rS0xChwb6JNujZMxydGJKWf6SGhUElVUKBiBU_GE5crGpWYnij4AbKb8zWbLpvzHhIPFDpfTeYXq8n8s8Y3fp71F2MEhiv-azA-1pdeBNARo-gUVSsBVxV552f3ZpSWNb5P8_-Dfj28x6jdjjdE7_RerrwPByz9EZGlDjcq2LB56Y7xyajhznnrR6Q5QoOxqYzbuuR6qLffqx7RTVC9dI71ga6Vj6R8amTGwKlzXxxK-jWwZJpCR0w7Eg&aioh=3&csuir=1&mtid=LJy_avCPIdroi-gP4NCBoA0|Google search]]
 +  * [[https://docs.hivemq.com/hivemq/latest/user-guide/security.html#authentication-authorization|Security features of HiveMQ]] - HiveMQ docs
 +
 +===== MQTT =====
 +
 +  * [[https://www.hivemq.com/mqtt/|MQTT Essentials]] by HiveMQ
 +    * very good resource
 +
 +  * [[https://www.hivemq.com/mqtt/mqtt-security-fundamentals/]] MQTT Security Fundamentals - a series by HiveMQ
 +    * ...
 +    * [[https://www.hivemq.com/blog/mqtt-security-fundamentals-tls-ssl/|TLS/SSL - MQTT Security Fundamentals]]
 +      * more info about TLS: https://hpbn.co/transport-layer-security-tls/
 +    * ...
 +
 +  * https://www.emqx.com/en/blog/fortifying-mqtt-communication-security-with-ssl-tls
 +==== MQTT Libraries ====
 +
 +  * HiveMQ MQTT Client
 +    * https://hivemq.github.io/hivemq-mqtt-client/
 +    * Repo: https://github.com/hivemq/hivemq-mqtt-client
 +
 +  * Eclipse Paho
 +    * https://eclipse.dev/paho/
 +    * Repo: https://github.com/eclipse-paho/paho.mqtt.android
 +    * Pros
 +      * ...
 +    * Cons
 +      * too old?
 +
 +
 +  * Misc
 +    * Nice article about MQTT and Android etc:
 +      * https://medium.com/swlh/android-and-mqtt-a-simple-guide-cb0cbba1931c
 +
 +
 +==== Android GPS Tracking Apps with MQTT support ====
 +
 +  * OwnTracks
 +    * [[https://owntracks.org/booklet/|OwnTracks booklet]] - information about the app
 +    * [[https://play.google.com/store/apps/details?id=org.owntracks.android|OwnTrack in Play Store]]
 +    * open source
 +  * SensorSpot 
 +    * https://github.com/umercodez/SensorSpot
 +    * an MQTT client, which also sends location (and other sensor data available on Android device)
 +    * open source