si_tyler
@twilson · Se unió el marzo 2026
System integrator · energy · 15 years in the field
- Temas
- 3
- Respuestas
- 20
- Puntos
- 0
Respuestas de foro creadas
Traducido del English por IA ·
Una cosa de campo: haga que el conjunto de comandos sea un estado, nunca un cambio de estado (toggle). Un comando que caduca solo significa que no llegó respuesta; es posible que se haya ejecutado igualmente. Si el supervisor vuelve a pulsar, fan.set on enviado dos veces es inofensivo, pero fan.toggle enviado dos veces apaga el ventilador.
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.
Traducido del English por IA ·
¿Pensaba que en los dashboards había una opción de «Enviar informe»?
I thought there was a «send report» option on dashboards?
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.
Traducido del English por IA ·
Pues eso es. Una Pi 3 no tiene reloj en tiempo real. Al arrancar restaura la hora que guardó en el último apagado limpio (fake-hwclock) y luego espera a NTP. Tu red de laboratorio bloquea NTP (UDP 123), así que el reloj se queda en el pasado y, para la biblioteca TLS, el certificado del servidor aún no es válido. Lo he visto en la mitad de las Pi de campo que he puesto en marcha tras cortafuegos muy restrictivos.Soluciones, elige una:
# 1. pide a TI el servidor NTP interno y úsalo
sudo nano /etc/systemd/timesyncd.conf
[Time]
NTP=ntp.your-lab.example
sudo systemctl restart systemd-timesyncd
timedatectl # "System clock synchronized: yes"
# 2. si solo está abierto el 443: sincroniza con las cabeceras HTTPS
sudo apt install htpdate
sudo htpdate -s https://www.example.org
Quita la IP fija. El broker necesita SNI, así que conéctate por nombre de host; el certificado se comprueba con ese nombre de todos modos, por eso obtuviste el error de discrepancia. Un client.tls_set() sencillo con el paquete de CA del sistema está bien; Tyler, no se necesita certificado de cliente para los inicios de sesión con token, el servidor lo pide pero no lo exige.Además, haz que el script espere a un reloj sincronizado antes de conectarse; si no, un reinicio en el laboratorio volverá a romperlo. Un bucle sencillo sobre timedatectl show -p NTPSynchronized funciona. Consulta la sección TLS de MQTT.
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.

