Von English mit KI übersetzt ·
Ich habe letztes Jahr zu Hause genau das uMQTTBroker-Vorgehen ausprobiert und dann aufgegeben. Danach habe ich dies umgesetzt, und es läuft seit 8 Monaten stabil. Ich bin kein Experte, also betrachte es als „was bei mir funktioniert hat“.Ein Pi Zero 2 W mit Mosquitto ist der lokale Broker. Die ESP8266-Knoten veröffentlichen im LAN dorthin, unverschlüsselt auf Port 1883 ist das dort in Ordnung, weil die Daten das Haus nie verlassen. Die Summerlogik ist ein kleines Python-Skript auf dem Pi, das lokal abonniert, es funktioniert also ganz ohne Internet.Für Hermetry ist der Pi ein einzelnes Gerät, das als Gateway markiert ist (der Schalter „Dieses Gerät ist ein Gateway“ beim Hinzufügen). Ein zweites Skript abonniert alles auf dem lokalen Broker, versieht jeden Messwert mit der Zeit des Pi (per NTP synchronisiert, prüfbar mit timedatectl), speichert sie in einer SQLite-Datei und sendet sie per paho-mqtt über TLS nach oben:
topic: v1/gw/telemetry
{
"freezer-1": [{"ts": 1762941600000, "values": {"temp": -18.6, "amps": 1.92}}],
"gate": [{"ts": 1762941605000, "values": {"open": 0}}]
}
Jeder Knoten wird anhand seines Namens zu einem untergeordneten Gerät. Eine Zeile wird erst nach dem PUBACK aus SQLite gelöscht. Wenn das Internet zurückkehrt, sendet es den Rückstand vom ältesten zum neuesten in Stapeln, und die Messwerte landen mit ihren echten Zeitstempeln in der Historie.Zwei Dinge habe ich auf die harte Tour gelernt. Hermetry ignoriert das Retain-Flag und überbrückt nicht zu deinem Broker, also verlasse dich auf keines von beiden. Und ein großer Rückstau wird mit der Rate „Replay messages per second“ des Profils abgebaut, daher braucht es nach einem langen Ausfall eine Weile, bis der Rückstand aufgeholt ist. Das ist normal.Die Seite, der ich gefolgt bin, war Devices behind a gateway.
I tried exactly the uMQTTBroker thing at home last year and gave up on it, then did this, which has been solid for 8 months. Not an expert, so take it as „what worked for me“.
A Pi Zero 2 W running Mosquitto is the local broker. The ESP8266 nodes publish to it on the LAN, plain 1883 is fine there because it never leaves the house. The buzzer logic is a tiny Python script on the Pi that subscribes locally, so it works with no internet at all.
For Hermetry, the Pi is one device marked as a gateway (the „This device is a gateway“ switch when you add it). A second script subscribes to everything on the local broker, stamps each reading with the Pi’s time (NTP-synced, check timedatectl), keeps them in a SQLite file, and sends them up with paho-mqtt over TLS:
topic: v1/gw/telemetry
{
"freezer-1": [{"ts": 1762941600000, "values": {"temp": -18.6, "amps": 1.92}}],
"gate": [{"ts": 1762941605000, "values": {"open": 0}}]
}
Each node becomes a child device by its name. It only deletes a row from SQLite after the PUBACK. When the internet comes back it sends the backlog oldest first, in batches, and the readings land at their real times in history.
Two things I learned the hard way. Hermetry ignores the retain flag and doesn’t bridge to your broker, so don’t build on either. And a big backlog drains at the profile’s Replay messages per second rate, so after a long outage it takes a while to catch up, that’s normal.
The page I followed was Devices behind a gateway.

