Traducido del English por IA ·
Primero el hardware. Usa un optoacoplador: puente rectificador (o un PC817 con un diodo inverso en paralelo con el LED), resistencia en serie de 1 kΩ, 10 µF en la salida para que el rizado de CA no aparezca como 50 pulsos por segundo. El lado del transistor a D5 con INPUT_PULLUP, de modo que el pin esté en LOW mientras suena. Antirrebote en el código, envía ring: 1 en el flanco de bajada y ring: 0 cuando lleve 2 s en silencio.Luego yo omitiría la regla de alarma. Una alarma tiene un ciclo de vida (abierta, reconocida, cerrada) y se acumularían alarmas por cada repartidor. Una regla de la tarjeta Rules encaja mejor:
When: A value changes, device "intercom-d1", value "ring", becomes 1
Then: Tell people [x] Members
Message: "Someone is at the street door"
Los miembros lo reciben en la campana, por push donde lo hayan configurado (la app, o un navegador con push activado), y en cada aplicación de chat que hayan vinculado en Mi perfil > Apps de chat. Así que, una vez que tu administrador conecte la plataforma, cada persona vincula su propia cuenta y ese es tu aviso en el teléfono, con o sin app. Los destinatarios de una regla de la tarjeta Rules nunca reciben correo electrónico ni SMS; para SMS necesitarías un flujo con un bloque Notify y números de teléfono.Una cosa que debes saber: el mismo aviso para la misma persona se retiene durante un enfriamiento de 10 minutos. Para un timbre de puerta está bien en general, pero si dos repartidores llegan con menos de 10 minutos de diferencia, el segundo solo aparece como «(+1)» en el siguiente aviso. Detalles: Notifications from rules and flows.
Hardware first. Use an optocoupler: bridge rectifier (or a PC817 with a reverse diode across the LED), 1 kΩ series resistor, 10 µF across the output so the AC ripple doesn’t show up as 50 pulses a second. Transistor side to D5 with INPUT_PULLUP, so the pin goes LOW while it rings. Debounce in code, send ring: 1 on the falling edge, and ring: 0 when it’s quiet again for 2 s.
Then I’d skip the alarm rule. An alarm has a lifecycle (open, acknowledge, clear) and you’d have alarms piling up for every courier. A Rules card rule fits better:
When: A value changes, device "intercom-d1", value "ring", becomes 1
Then: Tell people [x] Members
Message: "Someone is at the street door"
Members get it in the bell, by push where they’ve set it up (the app, or a browser with push on), and in every chat app they linked under My Profile > Chat apps. So once your admin connects the platform each person links their own account and that’s your phone ping, app or not. Rules card recipients never get e-mail or SMS, for SMS you’d need a flow with a Notify block and phone numbers.
One thing to know: the same notice to the same person is held back for a 10-minute cooldown. Fine for a doorbell mostly, but if two couriers come within 10 minutes the second one only shows up as «(+1)» on the next one. Details: Notifications from rules and flows.

