Internet kesildiğinde sensörlerin çalışmaya devam etmesi için ESP8266'yı yerel bir MQTT broker olarak kullanmak?
Yapay zekâ tarafından English dilinden çevrildi ·
Küçük bir depo ve yan taraftaki evim. Altı ESP8266 düğümü (sıcaklık, iki kapı kontağı, bir dondurucu akım pensesi, bir kapı sensörü). Her biri şu anda MQTT/TLS üzerinden tek başına Hermetry’ye bağlanıyor.Sorun: depodaki internet haftada birkaç kez kesiliyor, bazen bir saate kadar. Kesildiğinde düğümler her şeyi kaybediyor; ayrıca bunlardan biri, çalışmaya devam etmesini istediğim yerel bir buzzer’ı sürüyor (kapı açık + dondurucu sıcak = bip).ESP8266 üzerinde broker çalıştıran uMQTTBroker’ı buldum. Plan şöyle: bir ESP8266 yerel broker olsun, düğümler ona yayın yapsın, internet açıkken bir şey bunları Hermetry’ye iletsin. Bunu yapan oldu mu? 6 istemci için bir ESP8266 yeterli mi? Ve Hermetry’nin broker’ı buna köprü kurabilir mi ya da kesintiden sonra tutulan (retained) mesajları alabilir mi?
Small warehouse plus my house next door. Six ESP8266 nodes (temperature, two door contacts, a freezer current clamp, a gate sensor). Each one currently connects to Hermetry by itself over MQTT/TLS.
Problem: the warehouse internet drops a few times a week, sometimes for an hour. When it does, the nodes lose everything, and one of them also drives a local buzzer that I’d like to keep working (gate open + freezer warm = beep).
I found uMQTTBroker, which runs a broker on an ESP8266. Plan would be: one ESP8266 as local broker, nodes publish to it, something forwards to Hermetry when the internet is up. Has anyone done this? Is an ESP8266 enough for 6 clients? And can Hermetry’s broker bridge to it or receive retained messages after an outage?
Yapay zekâ tarafından English dilinden çevrildi ·
Kişisel olarak, ayakta kalması gereken o tek parçayı binadaki en zayıf çipe koymazdım. Ama diğerlerinin ne yaptığını merak ediyorum.
Personally I wouldn’t put the one piece that must stay up on the weakest chip in the building. But curious what others did.
Yapay zekâ tarafından English dilinden çevrildi ·
uMQTTBroker çalışıyor, bir süre kullandım. TLS yok ve benim durumumda yaklaşık 8 istemcide çöktü.
uMQTTBroker works, I ran it for a while. No TLS, and it fell over at about 8 clients for me.
Yapay zekâ tarafından English dilinden çevrildi ·
İnternet kesildiğinde Hermetry alarmlarına ne oluyor? Yoksa hiç tetiklenmiyorlar mı?
what happens to the Hermetry alarms when the internet is down? do they just not fire?
Yapay zekâ tarafından English dilinden çevrildi ·
@Rachel onlar yapamaz, Hermetry internet geri gelene kadar verileri hiç görmez. Aynı sebepten dolayı atölyede yerel interlock’ları tutuyor, bildirimler ve geçmiş için bulutu kullanıyoruz. Buzzer mantığınız sahada olmalı.
@Rachel they can’t, Hermetry never sees the data until it comes back. Same reason we keep local interlocks on the shop floor and use the cloud for notices and history. Your buzzer logic belongs on site.
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.
- Bu konuyu yanıtlamak için giriş yapmış olmalısınız.
Sohbete katılın
Soru sormak ve yanıtlamak, yararlı gönderileri beğenmek ve sorununuzu çözen yanıtı işaretlemek için oturum açın. Her katkı puan ve seviye kazandırır.

