si_tyler
@twilson · Mart 2026 tarihinde katıldı
System integrator · energy · 15 years in the field
- Konular
- 3
- Yanıtlar
- 20
- Puan
- 0
Oluşturulan forum yanıtları
Yapay zekâ tarafından English dilinden çevrildi ·
Sahadan bir not: komut setini her zaman bir durum olarak tasarlayın, asla toggle olarak değil. Zaman aşımına uğrayan bir komut yalnızca yanıt gelmediği anlamına gelir, yine de çalışmış olabilir. Supervisor tekrar basarsa, fan.set on iki kez gönderilmesi zararsızdır, fan.toggle iki kez gönderilirse ise fan kapanır.
One thing from the field: make the command set a state, never toggle. A command that times out only means no answer came back, it may have run anyway. If the supervisor presses again, fan.set on twice is harmless, fan.toggle twice turns it off.
Yapay zekâ tarafından English dilinden çevrildi ·
Panolarda bir “raporu gönder” seçeneği olduğunu düşünmüştüm?
I thought there was a “send report” option on dashboards?
Yapay zekâ tarafından English dilinden çevrildi ·
Trafo merkezlerinde aynı düzende yaklaşık otuz tane bu küçük ağ geçidini çalıştırıyorum.Kök dosya sistemi için overlay açık, evet. RaspAP değişikliklerini overlay kapalıyken yap, yeniden başlat, sonra tekrar aç. Sinir bozucu ama nadir.Tampon, yeniden başlatmalara ve güç kesintilerine dayanabilecek bir yere ihtiyaç duyar: karttaki ikinci bir bölüm (veya bir USB bellek), ext4 ve günlüğüyle okuma-yazma olarak bağlanmış, overlay’in dışında. SQLite’ı oraya yönlendir; PRAGMA journal_mode=WAL ve synchronous=NORMAL ile. Böylece bir kesinti en fazla son birkaç yazmaya mal olur, veritabanına değil. mosquitto’nun kalıcılığını da oraya taşı ya da iletici zaten tamponladığı için kalıcılığı kapat.Rachel’ın sorusuna gelince: ESP gönderdiğinde her okumaya UTC milisaniye cinsinden ts damgası basarsan evet (Pi’nin saati yalnızca 4G açıldıktan sonra senkronize olduğunda geçerli, ayrıca güç kesintisinden sonra 1970 görünmemesi için fake-hwclock kullan). Birikmiş verileri çocuk cihaz başına gruplar halinde gönder:
{"esp-bed3": [{"ts": 1767254400000, "values": {"soil_pct": 41}},
{"ts": 1767254460000, "values": {"soil_pct": 41}}]}
Kayıtlar geçmişte kendi zamanlarına yerleşir. Tüm kayıtları bir dakikadan eski olan bir mesaj yeniden oynatma sayılır ve profilin yeniden oynatma hızına uymak zorundadır, bu yüzden uzun bir birikim bir süre içinde boşalır. Hepsi bir saniyede görünmezse panik yapma. Ve satırları silmeden önce PUBACK’i bekle. Bkz. Devices behind a gateway.
I run about thirty of these little gateways on substations, same pattern.
Overlay on for the root filesystem, yes. Do your RaspAP changes with the overlay switched off, reboot, switch it back on. Annoying but rare.
The buffer needs a place that survives reboots and power loss: a second partition on the card (or a USB stick) mounted read-write with ext4 and its journal, outside the overlay. Point SQLite there, with PRAGMA journal_mode=WAL and synchronous=NORMAL. A cut then costs you at most the last few writes, not the database. Move mosquitto’s persistence there too, or turn persistence off since your forwarder already buffers.
On Rachel’s question: yes, if you stamp each reading with ts in UTC milliseconds when the ESP sends it (only if the Pi’s clock is synced, which it is once 4G is up, and keep a fake-hwclock so it isn’t 1970 after a power cut). Send the backlog in batches per child:
{"esp-bed3": [{"ts": 1767254400000, "values": {"soil_pct": 41}},
{"ts": 1767254460000, "values": {"soil_pct": 41}}]}
Records land at their own time in history. A message whose every record is older than a minute counts as a replay and has to fit the profile’s replay rate, so a long backlog drains over a while. Don’t panic when it doesn’t all appear in one second. And wait for the PUBACK before deleting rows. See Devices behind a gateway.
Yapay zekâ tarafından English dilinden çevrildi ·
Demek ki sorun bu. Pi 3’te gerçek bir gerçek zamanlı saat (RTC) yok. Açılışta, son düzgün kapatmada kaydettiği zamanı geri yüklüyor (fake-hwclock) ve sonra NTP’yi bekliyor. Laboratuvar ağınız NTP’yi (UDP 123) engelliyor, bu yüzden saat geçmişte kalıyor ve TLS kütüphanesi açısından sunucu sertifikası henüz geçerli değil. Kilitli güvenlik duvarlarının arkasındaki sahadaki Pi’lerin yarısında bunu gördüm.Çözümler, birini seçin:
# 1. BT biriminden dahili NTP sunucusunu isteyin ve kullanın
sudo nano /etc/systemd/timesyncd.conf
[Time]
NTP=ntp.your-lab.example
sudo systemctl restart systemd-timesyncd
timedatectl # "System clock synchronized: yes"
# 2. yalnızca 443 açıksa: HTTPS başlıklarından senkronize edin
sudo apt install htpdate
sudo htpdate -s https://www.example.org
Sabit kodlanmış IP’yi kaldırın. Broker SNI gerektirir, bu yüzden ana bilgisayar adıyla bağlanın; sertifika zaten bu ada göre kontrol edilir, uyuşmazlığın nedeni de budur. Sistem CA paketiyle düz client.tls_set() kullanmak uygundur; Tyler, belirteç ile girişlerde istemci sertifikası gerekmez, sunucu bir tane ister ama zorunlu tutmaz.Ayrıca betiğin bağlanmadan önce senkronize bir saati beklemesini sağlayın, aksi halde laboratuvarda bir yeniden başlatma sorunu yeniden oluşturur. timedatectl show -p NTPSynchronized üzerinde kısa bir döngü işe yarar. Ayrıntılar için MQTT sayfasının TLS bölümüne bakın.
That’s it then. A Pi 3 has no real time clock. At boot it restores the time it saved at the last clean shutdown (fake-hwclock) and then waits for NTP. Your lab network blocks NTP (UDP 123), so the clock stays in the past, and to the TLS library the server certificate isn’t valid yet. Seen this on half the field Pis I’ve commissioned behind locked-down firewalls.
Fixes, pick one:
# 1. ask IT for the internal NTP server and use it
sudo nano /etc/systemd/timesyncd.conf
[Time]
NTP=ntp.your-lab.example
sudo systemctl restart systemd-timesyncd
timedatectl # "System clock synchronized: yes"
# 2. if only 443 is open: sync from HTTPS headers
sudo apt install htpdate
sudo htpdate -s https://www.example.org
Undo the hardcoded IP. The broker needs SNI, so connect by host name, and the certificate is checked against that name anyway, which is why you got the mismatch. Plain client.tls_set() with the system CA bundle is fine; Tyler, no client certificate is needed for token logins, the server asks for one but doesn’t require it.
Also make the script wait for a synced clock before connecting, otherwise a reboot in the lab breaks it again. A quick loop on timedatectl show -p NTPSynchronized works. See the TLS section of MQTT.
On the bench both power supplies share mains earth, so the “isolated” sides are probably closer to each other than you think through supply capacitance.

