Yapay zekâ tarafından English dilinden çevrildi ·
Geçen yıl evde tam olarak uMQTTBroker yöntemini denedim, sonra vazgeçtim; ardından bunu yaptım ve 8 aydır sorunsuz çalışıyor. Uzman değilim, bunu “benim için işe yarayan” olarak değerlendirin.Mosquitto çalıştıran bir Pi Zero 2 W yerel broker görevi görüyor. ESP8266 düğümleri LAN üzerinden ona yayın yapıyor; orada düz 1883 portu yeterli, çünkü veri evin dışına çıkmıyor. Zil mantığı, Pi üzerinde yerel olarak abone olan küçük bir Python betiği, bu yüzden hiç internet olmadan da çalışıyor.Hermetry için Pi, gateway olarak işaretlenmiş tek bir cihaz (cihazı eklerken “Bu cihaz bir gateway’dir” anahtarı). İkinci bir betik, yerel broker’daki her şeye abone oluyor, her okumaya Pi’nin saatini (NTP ile senkronize, timedatectl ile kontrol edin) ekliyor, verileri bir SQLite dosyasında tutuyor ve paho-mqtt ile TLS üzerinden yukarı gönderiyor:
topic: v1/gw/telemetry
{
"freezer-1": [{"ts": 1762941600000, "values": {"temp": -18.6, "amps": 1.92}}],
"gate": [{"ts": 1762941605000, "values": {"open": 0}}]
}
Her düğüm, adına göre bir alt cihaz oluyor. SQLite’dan bir satırı yalnızca PUBACK alındıktan sonra siliyor. İnternet geri geldiğinde birikmiş veriler en eskiden başlayarak, gruplar halinde gönderiliyor ve okumalar geçmişte kendi gerçek zamanlarına yerleşiyor.Zor yoldan öğrendiğim iki şey var. Hermetry retain bayrağını yok sayıyor ve broker’ınıza köprü kurmuyor, bu yüzden ikisine de güvenmeyin. Ayrıca büyük bir birikim, profilin Replay messages per second hızında boşalıyor; bu yüzden uzun bir kesintiden sonra yetişmesi biraz zaman alıyor, bu normal.Takip ettiğim sayfa: 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.

