Traducido del English por IA ·
Tengo unas treinta de estas pequeñas pasarelas en subestaciones, con el mismo patrón.Overlay activado para el sistema de archivos raíz, sí. Haz tus cambios de RaspAP con el overlay desactivado, reinicia y vuelve a activarlo. Molesto pero poco frecuente.El búfer necesita un lugar que sobreviva a reinicios y cortes de energía: una segunda partición en la tarjeta (o una memoria USB) montada en lectura-escritura con ext4 y su journal, fuera del overlay. Apunta SQLite allí, con PRAGMA journal_mode=WAL y synchronous=NORMAL. Un corte entonces te costará como mucho las últimas escrituras, no la base de datos. Mueve también la persistencia de mosquitto allí, o desactívala ya que tu forwarder ya almacena en búfer.Sobre la pregunta de Rachel: sí, si marcas cada lectura con ts en milisegundos UTC cuando el ESP la envía (solo si el reloj de la Pi está sincronizado, lo cual ocurre una vez que 4G está activo, y mantén un fake-hwclock para que no aparezca 1970 tras un corte de energía). Envía el acumulado en lotes por hijo:
{"esp-bed3": [{"ts": 1767254400000, "values": {"soil_pct": 41}},
{"ts": 1767254460000, "values": {"soil_pct": 41}}]}
Los registros se guardan en su propio momento del historial. Un mensaje cuyos registros tienen todos más de un minuto de antigüedad cuenta como reproducción y debe ajustarse a la tasa de reproducción del perfil, así que un acumulado largo se vacía con el tiempo. No te preocupes si no aparece todo en un segundo. Y espera al PUBACK antes de borrar filas. Consulta 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.

