glomus_mqtt_integration
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| glomus_mqtt_integration [2026/10/08 07:20] – [Kilo] kalaschnikow | glomus_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:// | ||
| + | |||
| + | User: kalaschnikow@mail.ru | ||
| + | |||
| + | Pass: kiloYA..." | ||
| + | |||
| + | * MQTT connector | ||
| + | * Broker URL: < | ||
| + | * Topic prefix: iot/ | ||
| + | * If device name is " | ||
| + | * iot/ | ||
| + | * Username: mqtt_95f199fa | ||
| + | * Password: wfqY73FTLfzZ3qT9Mdg66guLGWNdV0bY | ||
| + | |||
| + | * Working "MQTT Settings" | ||
| + | * 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/ | ||
| + | * Data sent: < | ||
| + | {" | ||
| + | </ | ||
| + | |||
| + | * Working "MQTT Settings" | ||
| + | * 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/ | ||
| + | * Data sent: < | ||
| + | {" | ||
| + | </ | ||
| + | |||
| + | ==== OpenRemote ==== | ||
| + | |||
| + | [[OpenRemote]] | ||
| + | |||
| + | https:// | ||
| + | |||
| + | * Working "MQTT Settings" | ||
| + | * MQTT version: 3.1 | ||
| + | * SSL / TLS: true | ||
| + | * Host: awow2024 | ||
| + | * Port: 8883 | ||
| + | * Client ID: mqttx_aaf87899 | ||
| + | * User Name: master: | ||
| + | * Password: h0ZEXtVgEIf0xP1tLDweoU0l6PNuCpFf2GfGpm4rkpabcTdjnHOO174st79s7j1jScPEqsJxZfLk6jSwhAREL1 | ||
| + | * Topic: master/ | ||
| + | * Data sent: < | ||
| + | " | ||
| + | " | ||
| + | 8.72233, | ||
| + | 49.042166 | ||
| + | ] | ||
| + | }</ | ||
| + | |||
| + | |||
| + | ==== Thinger.io ==== | ||
| + | |||
| + | https:// | ||
| + | |||
| + | |||
| + | ==== ThingsBoard ==== | ||
| + | |||
| + | https:// | ||
| + | |||
| + | User: blubbsik@gmx.de | ||
| + | |||
| + | Pass: thingsYA... | ||
| + | |||
| + | |||
| + | |||
| + | A small "How To" by RouterOS: | ||
| + | https:// | ||
| + | ===== Clients for tests ===== | ||
| + | |||
| + | * MQTTX | ||
| + | * CLI | ||
| + | * UI App | ||
| + | * Ubuntu | ||
| + | * Windows | ||
| + | * ... | ||
| + | |||
| + | ===== Certificates / SSL etc ===== | ||
| + | |||
| + | Certificates are in ''/ | ||
| + | * myclient.p12 | ||
| + | * PKCS#12 keystore | ||
| + | * myclient.pfx | ||
| + | * key in pfx | ||
| + | * myclient.pem | ||
| + | * key in PEM | ||
| + | * myclient.pubkey.pem | ||
| + | * pubkey ? | ||
| + | |||
| + | * https:// | ||
| + | * tool to create / export certificates etc | ||
| + | |||
| + | A forum post (with example code?) that seems to be interesting: | ||
| + | https:// | ||
| + | |||
| + | Example code from google: | ||
| + | < | ||
| + | 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 = " | ||
| + | String truststorePassword = " | ||
| + | |||
| + | String keystorePath = " | ||
| + | String keystorePassword = " | ||
| + | |||
| + | // 2. TrustManagerFactory initialisieren (Zertifikat des Brokers validieren) | ||
| + | KeyStore trustStore = KeyStore.getInstance(" | ||
| + | try (InputStream tsIn = new FileInputStream(truststorePath)) { | ||
| + | trustStore.load(tsIn, | ||
| + | } | ||
| + | TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); | ||
| + | trustManagerFactory.init(trustStore); | ||
| + | |||
| + | // 3. KeyManagerFactory initialisieren (Eigenes Client-Zertifikat für mTLS - Optional) | ||
| + | KeyStore keyStore = KeyStore.getInstance(" | ||
| + | try (InputStream ksIn = new FileInputStream(keystorePath)) { | ||
| + | keyStore.load(ksIn, | ||
| + | } | ||
| + | KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); | ||
| + | keyManagerFactory.init(keyStore, | ||
| + | |||
| + | // 4. HiveMQ MQTT Client mit SSL-Konfiguration bauen | ||
| + | Mqtt5BlockingClient client = MqttClient.builder() | ||
| + | .useMqttVersion5() | ||
| + | .serverHost(" | ||
| + | .serverPort(8883) | ||
| + | .sslConfig() | ||
| + | .trustManagerFactory(trustManagerFactory) // Broker-Zertifikat prüfen | ||
| + | .keyManagerFactory(keyManagerFactory) | ||
| + | .applySslConfig() | ||
| + | .buildBlocking(); | ||
| + | |||
| + | // Client verbinden | ||
| + | client.connect(); | ||
| + | System.out.println(" | ||
| + | | ||
| + | client.disconnect(); | ||
| + | |||
| + | } catch (Exception e) { | ||
| + | e.printStackTrace(); | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | |||
| + | Also interesting : | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | ===== MQTT ===== | ||
| + | |||
| + | * [[https:// | ||
| + | * very good resource | ||
| + | |||
| + | * [[https:// | ||
| + | * ... | ||
| + | * [[https:// | ||
| + | * more info about TLS: https:// | ||
| + | * ... | ||
| + | |||
| + | * https:// | ||
| + | ==== MQTT Libraries ==== | ||
| + | |||
| + | * HiveMQ MQTT Client | ||
| + | * https:// | ||
| + | * Repo: https:// | ||
| + | |||
| + | * Eclipse Paho | ||
| + | * https:// | ||
| + | * Repo: https:// | ||
| + | * Pros | ||
| + | * ... | ||
| + | * Cons | ||
| + | * too old? | ||
| + | |||
| + | |||
| + | * Misc | ||
| + | * Nice article about MQTT and Android etc: | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | ==== Android GPS Tracking Apps with MQTT support ==== | ||
| + | |||
| + | * OwnTracks | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * open source | ||
| + | * SensorSpot | ||
| + | * https:// | ||
| + | * an MQTT client, which also sends location (and other sensor data available on Android device) | ||
| + | * open source | ||
