Zoneminder setup

Following on from my last post, I’m going to talk about how I’ve linked Zoneminder and Home Assistant with the assistance of zmEventNotification. This week I’ll start with getting Zoneminder configured.

To recap my setup, I have three IP based cameras:

  • A PoE Hikvision camera covering my front garden and front door, with a 1920×1080 high resolution feed and a 640×360 low resolution feed.
  • A cheap WiFi camera covering the side door and side access gate, with a 1280×720 high resolution feed and a 640×352 low resolution feed. The brand is S3VC, but it seems identical to dozens of other brands.
  • Another identical S3VC camera covering the backdoor and part of the back garden.

All three cameras are configured with the low resolution feed set to 10fps.


The first step was to configure the cameras. They need to have fixed IP addresses and, after discovering the number of outbound connections they were trying to make, I also blocked them from outbound internet access.

Note that if you do block outbound internet access and still want the cameras to add accurate timestamps to the images, you’ll either need to allow access out to an NTP server or point them at an NTP server on your internal network. If you’re running Zoneminder on a Linux box, that’s as good a place as any to set it up. If you’re also using Surveillance Station on a Synology NAS, you can also use that as an NTP server.

Installing Zoneminder was fairly straightforward using the RPM Fusion repository on my CentOS 7 server. It’s important to read the README for post-install steps. I would’ve preferred Docker, but there isn’t an image in the Docker repositories – to use Docker you have to build your own image, so I went with the path of least resistance and installed it directly on the server.

Setting up secure remote access to Zoneminder was a little tricky. It’s easy to get wrong and inadvertently allow unauthenticated access to your Zoneminder images. I chose to go for a belt and braces approach of enabling both Zoneminder’s own authentication and basic authentication in Apache. I’m also running multiple other virtual hosts from the same Apache instance, just to give myself more of a headache…

I got it working using the Apache Proxy Authorisation method devised by Adam Outler. The advantage of this approach is that I can directly access Zoneminder without basic auth on my local network using the IP address of the server, so, for example, Home Assistant can directly access Zoneminder with just Zoneminder’s own authentication. Accessing from outside using the external virtual host sends the request through a proxy that performs the Apache basic authentication before passing the request on to Zoneminder.

If you do choose to make your Zoneminder instance accessible from the internet with basic auth enabled, make sure you test it thoroughly. In particular, test the stream URL – this will be something like:

http://HOSTNAME/cgi-bin-zm/nph-zms?scale=150&width=960px&height=540px&mode=jpeg&maxfps=30&monitor=1

Test this from outside of your network and use a different browser, or browser in private/incognito mode, to ensure that credentials haven’t been cached. If you can get an image from your camera without basic authentication you’ll need to check your configuration.

I’ve ended up with what I think is a secure configuration, but the website doesn’t work when accessed remotely. Since I use zmNinja when I’m out, and that does work, it’s not really a problem. It’s on my list of things I need to look at…

I then set up Zoneminder to capture the low resolution feeds from the cameras. A low resolution of around 640×360 is sufficient to see what’s going on without putting excessive load on the server.

Once it was all running I had an issue with one of the S3VC cameras. Zoneminder kept losing the connection and couldn’t seem to capture more than 5fps. At first I put it down to Wifi connectivity, even though the straight line distance from router to camera isn’t that great. I then tried the same camera in Surveillance Station and found that it had no problem recording the high resolution stream at 12fps. That ruled out bandwidth and connectivity, and for a while I was stumped – the other, identical, camera was fine.

Eventually I tracked it down to the audio configuration. The S3VC cameras have microphones, but I’m not using the audio. It turned out that the ffmpeg decoder used by Zoneminder didn’t like the audio stream. Restricting the media type to video in the Zoneminder configuration for the camera solved the problem:

I still don’t know why one camera worked and the other didn’t. Both are on the same firmware level and I only had the issue with one of them. I guess that’s the price I paid for getting cheap cameras, but otherwise they’ve been fine.

The motion detection zones that I set up work well enough to keep false positives low, without eliminating them altogether. Since I was planning to add object detection, I felt it was better to err on the side of too many motion events rather than risk missing genuine events.

So that’s the background to my setup, and in the next post I’ll cover setting up object detection.

in Home Automation

Related Posts