Von English mit KI übersetzt ·
Ich betreibe etwa dreißig dieser kleinen Gateways in Umspannwerken, nach demselben Muster.Overlay für das Root-Dateisystem ist aktiv, ja. Nimm deine RaspAP-Änderungen mit ausgeschaltetem Overlay vor, starte neu und schalte es danach wieder ein. Lästig, aber selten.Der Puffer braucht einen Ort, der Neustarts und Stromausfälle übersteht: eine zweite Partition auf der Karte (oder ein USB-Stick), mit ext4 und Journal schreibend eingebunden, außerhalb des Overlays. Richte SQLite dorthin, mit PRAGMA journal_mode=WAL und synchronous=NORMAL. Ein Abbruch kostet dann höchstens die letzten Schreibvorgänge, nicht die Datenbank. Verschiebe auch die Persistenz von mosquitto dorthin oder schalte sie ab, da dein Forwarder ohnehin puffert.Zu Rachels Frage: Ja, wenn du jeden Messwert beim Senden durch den ESP mit ts in UTC-Millisekunden versiehst (nur wenn die Uhr des Pi synchronisiert ist, was sie nach dem Start von 4G ist, und behalte eine fake-hwclock bei, damit es nach einem Stromausfall nicht 1970 ist). Sende den Rückstau gebündelt pro Child:
{"esp-bed3": [{"ts": 1767254400000, "values": {"soil_pct": 41}},
{"ts": 1767254460000, "values": {"soil_pct": 41}}]}
Die Datensätze landen zu ihrer eigenen Zeit in der Historie. Eine Nachricht, deren Datensätze alle älter als eine Minute sind, gilt als Replay und muss zur Replay-Rate des Profils passen, daher wird ein langer Rückstau über einige Zeit abgebaut. Keine Panik, wenn nicht alles in einer Sekunde erscheint. Und warte auf das PUBACK, bevor du Zeilen löschst. Siehe 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.

