Main

A Wired Panic Button That Fires a Silent Alarm Without a Smart Speaker

A panic button is a reliability problem before it is a convenience problem. The interesting question is not which notification channel you pick. It is what the button does when Wi-Fi drops, when Home Assistant is restarting, or when the board loses power. If the answer is “nothing,” you have built a doorbell, not an alarm.

This article walks through one specific build: a normally-open momentary button wired to an ESP32 or ESP8266 running ESPHome, exposed to Home Assistant as a binary sensor, and used to fire a silent alarm — no speaker, no voice assistant, no audible chime. The silent-alarm path through Home Assistant is the second layer. The first layer is what the ESP board can do on its own.

What “silent” actually means here

Silent in this context means: no smart speaker announces anything, no chime plays, no voice assistant is involved. The alarm is delivered as a notification to a phone, a persistent notification in the Home Assistant UI, or an MQTT message that another system consumes. Whether a phone push is truly silent depends on the phone’s notification settings and the app’s channel configuration — that is a device-side setting, not something the automation can guarantee. Treat the phone’s notification channel as part of the build.

What the button cannot guarantee: that a human sees the notification. A silent alarm is only as good as the person watching the screen. If the threat model requires someone to be alerted even when they are not looking at a phone, a silent path is the wrong tool and a local siren or a plain wired buzzer is the honest choice.

The hardware path

The parts list is short:

  • An ESP32 or ESP8266 board. Mains-powered is simpler; battery-powered adds a power-budget problem you should solve deliberately.
  • A normally-open momentary push button. A panel-mount or surface-mount button is fine; a bare tactile switch works for a prototype but is not a panic button.
  • Two wires from the button to a GPIO pin and ground (for a pull-up configuration) or to 3.3V (for a pull-down configuration).

The ESPHome GPIO binary sensor platform “allows you to use any input pin on your device as a binary sensor” (ESPHome GPIO Binary Sensor docs). The important design decision is the idle state of that pin. A floating input reads noise. ESPHome’s own documentation says that if you hook up a button without an external pull-up, or if the log shows lots of ON/OFF events, “this often means the GPIO pin is floating” and you need to enable the internal pull-up or pull-down resistor (same page).

Two wiring options, both valid:

  • Pull-up: button between GPIO and ground, internal pull-up enabled, sensor inverted so pressed reads ON. This is the common configuration and the one to default to.
  • Pull-down: button between GPIO and 3.3V, internal pull-down enabled, sensor not inverted. Less common on ESP boards but works.

An external resistor is not strictly required if the internal pull-up is reliable on your board, but on a long wire run to a wall-mounted button, an external 10k pull-up at the board end is cheap insurance against noise. That is a recommendation, not a measured result.

The ESPHome configuration

A minimal, debounced configuration looks like this:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO4
      mode:
        input: true
        pullup: true
      inverted: true
    name: "Panic Button"
    device_class: safety
    filters:
      - delayed_on_off: 20ms
    on_press:
      then:
        - logger.log: "Panic button pressed"

Three details matter here.

Pull-up and inversion. With the button wired to ground and the internal pull-up enabled, the pin reads high when idle and low when pressed. The inverted: true flag makes the sensor report ON when pressed, which is what you want in the log and in Home Assistant.

Debounce. Mechanical contacts bounce. ESPHome’s binary sensor filters include delayed_on, which “only send[s] an ON value if the binary sensor has stayed ON for at least the specified time period” (ESPHome Binary Sensor docs). The delayed_on_off filter applies the same logic to both edges. ESPHome’s own multi-click documentation recommends delayed_on_off: 20ms as “a good starting point for most tactile switches” (same page). For a panic button, 20ms is a reasonable starting value; if the log shows phantom presses, raise it. If it shows missed presses on a slow deliberate push, lower it.

On-device action. The on_press block runs on the ESP board itself. ESPHome’s automation documentation is explicit about why this matters: “IoT devices should not depend on network connections to perform their jobs” (ESPHome Actions docs). That is the argument for putting at least one action in the ESPHome config rather than relying entirely on Home Assistant. What that action is depends on your hardware. If the board has a spare relay, you can drive a local buzzer or a relay that cuts power to something. If it does not, the on-device action can be a log line and a state publish — useful for diagnosis, not for alerting.

The Home Assistant side

Home Assistant sees the button as a binary sensor entity. The automation trigger should be a state trigger on that entity, not a condition that checks whether the button is currently pressed. Home Assistant’s trigger documentation is clear: “A trigger reacts at a specific moment, not while something is true” (Home Assistant Trigger docs). A state trigger on binary_sensor.panic_button going to on fires once per press. That is what you want.

A minimal automation:

alias: Panic button silent alarm
triggers:
  - trigger: state
    entity_id: binary_sensor.panic_button
    to: "on"
actions:
  - action: notify.persistent_notification
    data:
      title: "Panic button pressed"
      message: "{{ now().strftime('%H:%M:%S') }}"
  - action: notify.mobile_app_your_phone
    data:
      title: "Panic button"
      message: "Pressed at {{ now().strftime('%H:%M:%S') }}"
      data:
        channel: alarm_stream
        importance: high

The notify.persistent_notification action creates a notification in the Home Assistant UI. The mobile app notification is a push to the phone. Whether that push is silent depends on the phone’s notification channel settings — the channel and importance keys in the data block are Android-specific and are documented in the Home Assistant companion app docs, not in the core automation docs. A specific channel name is not guaranteed to work silently on every phone; that is a setting to verify on your own device.

If you want a latching state — the alarm stays on until someone acknowledges it — add an input boolean or a helper that the automation turns on, and a separate action (a dashboard button, a script) that turns it off. Do not rely on the button entity staying ON; a momentary button releases. The latch is what makes the alarm persist.

Failure modes to design for

Four failure modes matter for this build, and they are not equally covered by the local-first stack.

Floating pin. Covered by the pull-up and the debounce filter. Verify by watching the ESPHome log with the button untouched for a few minutes. If you see ON/OFF transitions with no one near the button, the pin is floating or the wire is picking up noise. Fix the wiring before trusting the button.

Contact bounce. Covered by delayed_on_off. Verify by pressing the button slowly and watching the log for a single clean transition. If you see multiple transitions per press, raise the debounce value.

ESPHome or Home Assistant offline. Partially covered. The ESPHome on_press action runs on the board regardless of network state, so a local relay or buzzer still fires. The Home Assistant automation does not run if Home Assistant is down. If the ESP board loses Wi-Fi, it cannot reach Home Assistant, and the silent alarm does not fire. This is the honest limitation of a network-dependent silent alarm. If the threat model requires the alarm to fire during a network outage, the local action on the ESP board is the only layer that survives.

Wi-Fi loss. Same as above. The ESPHome device will reconnect when Wi-Fi returns, but the press during the outage is only recorded if the on-device action did something with it. ESPHome does not buffer button presses for later delivery to Home Assistant by default; that is a design decision you would have to make explicitly.

For readers running Zigbee or Z-Wave buttons instead of a wired ESPHome board, the availability behavior is different. Zigbee2MQTT’s availability feature publishes a retained online/offline state per device and is disabled by default (Zigbee2MQTT Device Availability docs). A battery-powered Zigbee button that checks in every 25 hours by default will show as unavailable between check-ins if you enable availability with the default timeout. If your alarm automation is conditioned on the button being “available,” a sleepy button can silently disable the alarm. That is a real trap, and it is why the wired ESPHome path is simpler: a mains-powered ESP board is always connected, and its availability is a network question, not a battery question.

Verification procedure

Do not trust the button until you have walked through this sequence. Each step isolates one layer.

  1. Watch the ESPHome log with the button untouched for five minutes. You should see no ON/OFF transitions. If you do, the pin is floating or noisy. Fix the wiring or raise the debounce before continuing.
  2. Press the button once and watch the log. You should see a single ON transition followed by a single OFF transition when you release. Multiple transitions per press means the debounce is too short.
  3. Open the Home Assistant automation trace. Press the button and confirm the automation fired. The trace shows which trigger fired and which actions ran. If the automation did not fire, check that the entity ID in the trigger matches the entity ID in Home Assistant — a renamed entity is a common cause.
  4. Confirm the notification arrived. Check the Home Assistant UI for the persistent notification and check the phone for the push. If the push did not arrive, the problem is in the notify action or the phone’s notification settings, not in the button.
  5. Unplug the network and press the button. Watch the ESPHome log (over USB serial, not Wi-Fi) to confirm the on-device action ran. Then plug the network back in and check whether Home Assistant saw anything. It will not have, because the press happened while the connection was down. This step tells you which layer failed, rather than assuming the whole chain works.

Step 5 is the one most people skip. It is also the one that tells you whether the build meets the threat model. If the silent alarm must fire during a network outage, step 5 will show you that it does not, and you can decide whether to add a local siren, a cellular backup, or a different approach.

Maintenance

A panic button that is never pressed is a button you have not tested. Two maintenance tasks matter:

  • Periodic test press. Once a month, press the button and confirm the notification arrives. This catches dead batteries, disconnected wires, and renamed entities. Put it on a calendar; it takes thirty seconds.
  • Check the entity is not unavailable. In Home Assistant, the button entity should show as available. If it shows unavailable, the ESP board is offline — check power and Wi-Fi. A mains-powered ESP board should never be unavailable for long; if it is, the power supply or the Wi-Fi connection is the problem.

If the board is battery-powered, the power budget is the maintenance task. A mains-powered board avoids the problem entirely, and for a panic button that is the right tradeoff unless the installation location has no power.

When a plain switch is the smarter choice

Not every panic button needs a microcontroller. If the requirement is “make a loud noise when pressed,” a mechanical siren or a plain wired buzzer is cheaper, simpler, and has no network dependency. If the requirement is “notify one person who is always looking at their phone,” a phone shortcut or a dedicated app may be simpler than a Home Assistant automation. The smart-home build earns its complexity when you need the button to participate in a larger system — logging, multiple notification targets, integration with other automations, or a latching state that other systems can read. If you do not need those things, the plain switch is the honest answer.

For readers who want to audit the rest of their installed systems before adding another device, the procedure in How to Audit the Small Systems That Quietly Run Your Week is a useful starting point. A panic button is one more small system, and it deserves the same scrutiny as the rest.

FAQ

Can I use a Zigbee or Z-Wave button instead of a wired ESPHome board? Yes, and the Home Assistant automation side is the same. The difference is the failure modes: a battery-powered Zigbee button may show as unavailable between check-ins, and the availability timeout is configurable in Zigbee2MQTT. A wired ESPHome board is always connected and its availability is a network question, not a battery question.

What happens if Home Assistant is restarting when the button is pressed? The ESPHome on-device action runs, but the Home Assistant automation does not. The press is not buffered for later delivery. If this matters, the on-device action needs to do something useful — a local relay, a buzzer, or a log line you can review later.

How do I make the alarm latch until acknowledged? Add an input boolean helper that the automation turns on, and a separate action (a dashboard button or a script) that turns it off. Do not rely on the button entity staying ON; a momentary button releases.

Is 20ms the right debounce value? It is ESPHome’s recommended starting point for tactile switches. Watch the log for phantom presses (raise it) or missed presses (lower it).

Can the notification be truly silent? The Home Assistant side can send a push, but whether the phone plays a sound depends on the phone’s notification channel settings. That is a device-side configuration, not something the automation can guarantee. Verify on your own phone.