Skip to content
Blog

My security cameras text me on Signal

Florian Mathieu
, 2 min read, filed under go, api, home-automation, signal, open-source

Tech stack
  • Go
  • Synology Surveillance Station
  • Signal
  • GitHub Actions
Repository on GitHubRealKeyboardWarrior/synology-surveillance-station-go

My cameras record to a Synology NAS running Surveillance Station. It’s good at the recording part: every camera, around the clock, with motion detection marking the moments that matter. Where it fell short was telling me about those moments. A notification that says “motion detected” doesn’t answer the only question I have when my phone buzzes: is that the postman, the cat, or someone who shouldn’t be there?

What I wanted was simple. When a camera sees something, a message lands in Signal, the app I already have open all day, with a picture of what it saw. One glance, and I know whether to do anything about it.

What it looks like

A camera detects motion. A few seconds later there’s a Signal message on my phone: the name of the camera and the event as its title, and the snapshot Surveillance Station took at that moment attached. It goes to whoever’s on the list, so everyone in the house gets the same alert. No extra app, no account with a camera cloud, and the pictures go straight from the NAS to Signal, end-to-end encrypted.

Behind it there are three pieces, all on the home network:

  • Surveillance Station notices motion and calls a webhook;
  • a small Go service picks up the webhook, fetches the snapshot and builds the message;
  • a Signal gateway, signal-cli behind a REST API, registered to its own number, which sends it.

First version: talking to Surveillance Station myself

Surveillance Station has a web API, but there was no Go client for it, so the first step was writing one. It logs in, lists the cameras, takes a snapshot from any of them, and reads the Home Mode settings. With that, the notifier could react to an event by grabbing fresh snapshots from the cameras and sending those along.

The API had its quirks. Home Mode, for instance, returns its list of cameras as a JSON array, unless there aren’t any, in which case it returns the string "-1". The library smooths that over so nothing using it has to care, and it has tests that replay real API responses to make sure it stays that way. It’s open source, so the next person who wants to script their Synology cameras from Go doesn’t have to start from scratch.

Second version: less code

Then Surveillance Station’s webhooks got better. A webhook can now include a link to the image the camera captured when the event fired. That’s exactly the picture I wanted, taken at the right moment, rather than a snapshot grabbed a second or two later when whoever triggered it might be gone.

So the notifier got smaller. It no longer logs in to anything: it receives the webhook, downloads the capture it points to, and passes it to Signal. The whole service is one Go file, and has very little that can break.

Why bother

There are camera systems that do all of this out of the box. They usually do it by sending your footage through someone else’s cloud. This setup keeps the recordings on my own hardware and only sends the moments I need to see, to the people who need to see them, over a messenger I trust. And when I want it to behave differently, it’s my code.