Que un Pi del laboratorio lea en voz alta las nuevas alarmas de Hermetry por un altavoz
Traducido del English por IA ·
Yo otra vez. Nuestro laboratorio tiene 6 congeladores e incubadoras en Hermetry con reglas de alarma y funcionan, pero las alertas van a la campana y nadie mira la pantalla cuando se llevan guantes. El PI preguntó si un altavoz podría decir simplemente «Congelador 3 temperatura alta» en la sala.Tengo un Pi 4 de repuesto y un altavoz USB. La conversión de texto a voz sin conexión funciona (probé piper y espeak-ng, piper suena mucho mejor). Lo que no entiendo es cómo se entera el Pi de una nueva alarma. Configuré un webhook en Hermetry apuntando al Pi y nunca llega nada. El Pi está en la red de la universidad detrás de NAT, sin dirección pública. ¿Un webhook es la herramienta equivocada?
Me again. Our lab has 6 freezers and incubators on Hermetry with alarm rules and they work, but alerts go to the bell and nobody looks at the screen while wearing gloves. The PI asked if a speaker could just say «Freezer 3 temperature high» in the room.
I have a spare Pi 4 and a USB speaker. Offline text to speech works (I tested piper and espeak-ng, piper sounds much nicer). The part I don’t get is how the Pi finds out about a new alarm. I set up a webhook in Hermetry pointing at the Pi and nothing ever arrives. The Pi is on the university network behind NAT, no public address. Is a webhook the wrong tool?
Traducido del English por IA ·
¿Podrías hacer que anuncie por correo electrónico de alguna manera? ¿Como que lea la bandeja de entrada?
Could you have it announce by e-mail somehow? Like read the inbox?
Traducido del English por IA ·
Los webhooks necesitan una URL HTTPS a la que Hermetry pueda acceder desde fuera, así que detrás de NAT nunca llegarán. Necesitarías un túnel o un proxy inverso, y es probable que el departamento de informática de la universidad diga que no.
Webhooks need an HTTPS URL Hermetry can reach from outside, so behind NAT they’ll never land. You’d need a tunnel or a reverse proxy, and uni IT will probably say no.
Traducido del English por IA ·
O invierte el planteamiento y haz que la Pi pregunte. El modelo pull es mejor que el push cuando el receptor está detrás de NAT.
Or turn it around and have the Pi ask. Pull beats push when the receiver is behind NAT.
Traducido del English por IA ·
siguiendo esto, quiero esto también para mi cosa del interfono jaja
following, I want this for my intercom thing too lol
Traducido del English por IA ·
Hacemos esto en nuestra planta: una Pi con un altavoz de bocina lee las alarmas críticas por encima del ruido. Ciaran tiene razón, consulta la API de Alarms.Pide a tu administrador una clave de API solo con el permiso de lectura de alarmas (leer alarmas es un permiso de nivel Usuario por defecto) y una lista de IP permitidas para la dirección de la universidad. Luego:
import requests, subprocess, time
H = {"Authorization": f"Bearer {API_KEY}"}
URL = f"https://{HOST}/tenant/{TENANT}/api/iot/alarms"
seen = set()
while True:
r = requests.get(URL, headers=H, params={"status": "OPEN", "severity": "CRITICAL,MAJOR",
"sort": "opened:desc", "pageSize": 20}, timeout=10)
for a in r.json()["items"]:
if a["alarmId"] not in seen:
seen.add(a["alarmId"])
subprocess.run(["sh", "-c", f'echo "{a["deviceName"]}: {a["title"]}" | piper --model en_GB-alan-medium.onnx --output-raw | aplay -r 22050 -f S16_LE'])
time.sleep(15)
El estado OPEN significa que las alarmas reconocidas dejan de leerse, lo que a la gente le gusta: reconócela en la app y la sala se queda en silencio. Pon a tus reglas de alarma títulos legibles, porque eso es lo que se lee en voz alta, por ejemplo «{{device.name}} temperatura {{value}}». Quince segundos es una frecuencia de sondeo razonable; mantente muy por debajo de los límites de la API. Si algún día obtienes un endpoint público, el webhook alarm.created sustituiría el sondeo: Webhooks.
We do this on our plant floor, a Pi with a horn speaker reads critical alarms over the noise. Ciaran’s right, poll the Alarms API.
Ask your admin for an API key with only the alarm read permission (reading alarms is a User-level permission by default) and an IP allowlist for the uni’s address. Then:
import requests, subprocess, time
H = {"Authorization": f"Bearer {API_KEY}"}
URL = f"https://{HOST}/tenant/{TENANT}/api/iot/alarms"
seen = set()
while True:
r = requests.get(URL, headers=H, params={"status": "OPEN", "severity": "CRITICAL,MAJOR",
"sort": "opened:desc", "pageSize": 20}, timeout=10)
for a in r.json()["items"]:
if a["alarmId"] not in seen:
seen.add(a["alarmId"])
subprocess.run(["sh", "-c", f'echo "{a["deviceName"]}: {a["title"]}" | piper --model en_GB-alan-medium.onnx --output-raw | aplay -r 22050 -f S16_LE'])
time.sleep(15)
Status OPEN means acknowledged alarms stop being read, which people like: ack it in the app and the room goes quiet. Give your alarm rules readable titles because that’s what gets spoken, e.g. «{{device.name}} temperature {{value}}». Fifteen seconds is a polite poll rate, stay well under the API limits. If you ever do get a public endpoint, the alarm.created webhook would replace the polling: Webhooks.
Traducido del English por IA ·
Lo puse en marcha ayer y a todos en el laboratorio les encanta. No tuve que pedirle nada a IT, lo cual fue una victoria. Solo una cosa: al principio usé status=active y, después de un reinicio, repetía alarmas ya reconocidas porque mi seen-set estaba vacío. Cambié a OPEN, como ustedes habían escrito. También tuve que cambiar los nombres de los dispositivos de «frz-03» a «freezer three» porque piper leía «frz» como «frz» sin sentido.
Got it running yesterday, everyone in the lab loves it. Had to ask IT nothing, which was a win. Only thing: I first used status=active and it kept repeating acknowledged alarms after a restart because my seen-set was empty, switched to OPEN like you wrote. Also had to change device names from «frz-03» to «freezer three» because piper read it as «frz».
- Debes estar registrado para responder a este debate.
Únete a la conversación
Inicia sesión para preguntar y responder, dar me gusta a las publicaciones útiles y marcar la respuesta que resolvió tu problema. Cada aportación suma puntos y niveles.

