The Listening Nest Box

Home Assistant

The script talks to Home Assistant through a webhook. Home Assistant turns the messages into a push notification and a dashboard tile.

1. A switch for "bird present"

Settings → Devices & services → Helpers → create a Toggle named "Bird present". That gives input_boolean.bird_present.

2. The automation

Trigger: Webhook with a long random ID, allowed method POST only, local only switched on. Then a "choose" on the message:

Message (trigger.json.state)Action
motionPush notification to the phone ("Movement in the nest box")
occupiedTurn input_boolean.bird_present on
emptyTurn input_boolean.bird_present off
Treat the webhook address like a password. Anyone inside your network who knows it can switch the tile. Keep it only in the service drop-in file, never in the script, a screenshot or a public repository.

Test without a bird, from the Pi:

curl -s -o /dev/null -w "%{http_code}\n" -X POST -H "Content-Type: application/json" \
  -d '{"state":"motion"}' http://<home-assistant>:8123/api/webhook/<secret-id>

Expected: 200. The automation's Traces show what arrived.

3. The dashboard tile

A tile card for input_boolean.bird_present, name "Bird present", bird icon, with a visibility condition "state is on". The tile appears only while somebody is in the box.

Dashboard tile showing a bird present
The tile on the dashboard while the box is occupied. The tile is named "Vogel anwesend" (German for "bird present") in my setup.

4. Push notifications

Install the Home Assistant companion app on the phone. A focus mode such as "Sleep" silences the push; allow the Home Assistant app in that focus if you want notifications at night.

5. Live picture on iPhone and Apple TV

The route is: Pi stream → Home Assistant camera → HomeKit → Home app. Everything stays in the home network, iCloud recording is off. The picture has no sound and a delay of a few seconds.

  1. Camera in Home Assistant: add the Generic Camera integration with stream source rtsp://<pi-address>:8554/nestbox, RTSP transport tcp, name "Nest box".
  2. HomeKit bridge: add the HomeKit Bridge integration and tick only the Camera domain. Home Assistant then creates a separate accessory-mode entry that holds just the camera.
  3. Pair: open the "HomeKit Pairing" notification in Home Assistant, then in the Home app tap + → Add Accessory, scan the QR code and accept the "uncertified accessory" warning.
  4. Apple TV: Home app → Cameras → Nest box.
Pitfall: do not tick several domains. A bridge with many domains exposes dozens of devices (78 in my case). Never pair that one; delete it under Devices & services → HomeKit Bridge → ⋮ → Delete. Leave any existing HomeKit entries alone.
Screenshot of the Home app on an iPhone: the Cameras section shows the live infrared picture from inside the nest box
The nest box camera in the Home app on the iPhone (the Apple TV shows the same picture). The small label shows the age of the frame in seconds.

If the picture hangs, check the stream first (systemctl is-active mediamtx), then close and reopen the Home app on the Apple TV.