What, Why & How Zoneminder?

What is Zoneminder

Zoneminder is a Free Open Source Software (FOSS) Network Video Recorder (NVR). It is claims to be one of the most advanced and scalable video surveillance systems available. It provides an API that can be used via a web interface, a mobile app, or third party software. Out of the box
Zoneminder offers a simple camera viewer, motion detection, event notifications, and much more. Since a picture is worth a thousand words, here’s what a ‘montage’ view on Zoneminder looks like (via the iOS app and the web view).

The Mobile App (ZmNinja) is also open source. It can be compiled or purchased on the AppStore for around $6. It offers a very elegant and full-featured interface to mange cameras, view events, and receive push notifications to mention a few.

This screenshot of the web view shows a list of connected cameras, their configurations, and events. A ‘montage’ camera stream view similar to the iOS view is also available.

Why use Zoneminder?

  • It’s Open Source! If you’ve read any of my other posts, I’m a huge proponent of Free & Open Source Software (FOSS). Open Source means the software can be trusted to not include nasty key loggers and other privacy invasive features (I’ll admit I rarely verify this myself).
  • It’s Free! Since Zoneminder is free (and always will be) it is worth trying!)
  • It’s feature rich! It lacks very little (if any) features that commercial NVR systems offer.
  • It’s relatively easy to install (See below for installation/configuration details)
  • It’s locally controlled! (No cloud needed – or wanted!
  • It has an optional Open Source mobile App (Approx. $6 if you buy it on the AppStore)
  • It’s hardware efficient (IMO – It seems to require less resources than alternatives).
  • It has a Home Assistant integration!

If the above reasons aren’t enough to convince you to give Zoneminder a try, I can tell you from experience that I’ve tried most of the other alternatives to Zoneminder (MotionEye, BlueIris, AgentDVR) and have found Zoneminder to be superior in most respects (although a bit more advanced to setup – see below). I don’t mean to be critical, but below I will list my main complaints about the alternatives I’ve listed. If I’ve forgotten about other good alternatives, pleas let me know in the comments!

  • MotionEye
    • Seemed to be quite resource hungry
    • No mobile app (although web interface is quite reasonable)
    • Did not seem very scalable (more than 4 cameras seemed to be buggy for me)
  • BlueIris
    • Currently Windows Only as of 2021
    • Not Free ($65 as of 2021)
    • Not Open Source
  • AgentDVR
    • Subscription required for advanced features and updated via web GUI
    • Requires a web account for some features
    • Requires webRTC (a technology I’m not a huge fan of)
    • No mobile App (although webGUI is quite reasonable)

How Zoneminder?

I’ll admit that Zoneminder can seem daunting to setup for someone not very tech-savvy, and may not be the best choice for someone with no knowledge of linux or command line experience. For most people that are reading this they probably already have enough tech knowledge or are willing to learn how to setup Zoneminder. There are a variety of ways to setup Zoneminder, but since I already use Docker, it was definitely the easiest path for me and the one I will outline below:

Install Docker Engine

If you don’t already have the docker engine installed, you’ll need to install it via the terminal or via a Docker Desktop application. Once installed you will have access to the docker terminal command.

Install Docker-Compose

Although docker-compose isn’t technically required, it does make running docker containers much more manageable and repeatable (if the physical computer you have docker on crashes). Follow the official documentation to install docker-compose.

Create your docker-compose file.

Create a directory somewhere called docker-compose (mine is located at ~/docker-compose). Inside that directory create a file named docker-compose.yaml and in a text editor modify the file to look like the following (If you want to access Zoneminder on a port other than 80, modify the first ’80’ in the ports section, otherwise, leave it as is).

version: "3"
services:

  # Zoneminder Docker-Compose Configuration
  zoneminder:
      container_name: zoneminder
      restart: always
      image: dlandon/zoneminder
      network_mode: bridge
      privileged: false
      shm_size: 1gb
      ports:
          - '80:80/tcp'
          - '9000:9000/tcp'
      environment:
          - TZ=America/New_York
          - PUID=99
          - PGID=100
          - INSTALL_HOOK=0
          - INSTALL_FACE=0
          - INSTALL_TINY_YOLOV3=0
          - INSTALL_YOLOV3=0
          - INSTALL_TINY_YOLOV4=0
          - INSTALL_YOLOV4=0
          - MULTI_PORT_START=0
          - MULTI_PORT_END=0
      volumes:
          - zoneminder_config:/config:rw
          - zoneminder_data:/var/cache/zoneminder:rw

volumes:
  # Zoneminder docker volumes (located in /var/lib/docker/volumes)
  zoneminder_config:
  zoneminder_data:

That’s about it, now we should be able to run Zoneminder! A few optional notes before we try it:

  • The configuration above will automatically start Zoneminder whenever the host machine (your computer, or the Proxmox Virtual Machine in my case – stay tuned for some Proxmox tutorials!) is started.
  • The configuration above can also be modified to also run a ZoneminderEventNotification, object detection server, and more. Basically you just need to change the 0’s to 1’s (note if you do this it could take hours on the first start of Zoneminder since it will need to compile dependencies).

Running Zoneminder!

To start Zoneminder we just need to tell docker to run our docker-compose file which will run any containers defined in it (currently only Zoneminder). To run the docker-compose file simply run:

# Remember this command - you'll need it to restart your docker containers
# if they don't start up automatically for some reason

docker-compose up -d

# If you get a permissions error, you may need to run the command as sudo

sudo docker-compose up -d

Give it a few minutes to configure itself and then try to navigate to http://<your-computer-ip-address>/zm/ or http://localhost/zm/ and you should see Zoneminder!

If you don’t see the Zoneminder web interface, give it some more time because it could still be starting up (it takes a while on the first start). For additional troubleshooting you can also visit the Zoneminder Forums.

Zoneminder System Configuration

I’ll leave all the advanced options up to you, but some Zoneminder options should probably be changed right away by clicking on the Options menu:

  • I would recommend adding authentication under Options > System > OPT_USE_AUTH
    • If using authentication, add some random text to Options > System > AUTH_HASH_SECRET
  • If you want to use Zoneminder with Home Assistant, make sure Options > System > OPT_USE_API is enabled (see below for Home Assistant configuration)

Add Cameras

To add a camera, simply click on +Add in the Console view. You will be prompted with a camera configuration – don’t be overwhelmed with the options, you only need to change a few:

  • General Tab:
    • Name : the name of your camera
    • Source Type:
      • ffmpeg if you have access to an RTSP stream for your camera
      • Remote if you only have an ip address for your camera and no RTSP stream
  • Source Tab:
    • If using ffmpeg, enter your RTSP stream in Source Path
    • If using Remote, enter your camera’s ip address in Host Name and choose the camera’s port and/or path of the camera image files
    • Choose your camera’s resolution

Click Save.

After saving the camera configuration you should see the camera on the Console view with a green indicator icon. If the indicator is red, you may need to play with the camera configuration some more or consult the Zoneminder documentation for more details about your type of camera.

Home Assistant Integration

If you haven’t heard of Home Assistant, read my post about it here. If you know about Home Assistant you’ll want the integration which is almost too easy to install. Simply navigate to Configuration > Integrations > + and search for Zoneminder. If you don’t find Zoneminder, you may need to set it up via configuration.yaml since the config-flow setup was removed after a bug was found. To set up the integration manually, add the following to your configuration.yaml:

# Be sure to add zoneminder_url, zoneminder_username, and zoneminder_password
# to your secrets.yaml file!

zoneminder:
  - host: !secret zoneminder_url
    username: !secret zoneminder_username
    password: !secret zoneminder_password

camera:
  - platform: zoneminder

For additional configuration options see the Home Assistant docs.

Enjoy your Home Assistant integration!

Closing Notes

This post was not intended to cover all the features and configurations of Zoneminder. Don’t forget to explore other features configurations like:

  • The Mobile App
  • Event/Alert Notifications
  • Object Detection (see yolov4 in your docker_compose file)
  • Remote Access from outside your network so you can access it like: https://zoneminder.yourdomain.com
    • (I’d suggest using a reverse proxy like NGINXProxyManager – stay tuned for a tutorial about this)

Introduction to Home Assistant

Everyone likes home automation – if it works! We’ve all been excited about that smart switch or wireless light that we can control from anywhere in the world, but how great is it really? For a few ‘smart’ devices it may seem work well, but once you begin to accumulate more than a handful of devices you will quickly begin to realize that you have as many apps as you do smart devices and you will begin to start asking questions like:

  • Which app controls which device?
  • Do I have to download all these apps for each member of my family?
  • Wouldn’t it be nice if I could control all my smart devices with a single app?
  • Why can’t I connect my smart devices together?

All of these questions can be answered with a tool called Home Assistant. In the most basic of terms, Home Assistant is a tool that pulls all of your smart devices into a single app. I will save the details of Home Assistant future posts, but it aims to do the following and much more:

  • Be Free and Open Source (FOSS)
  • Improve your privacy by reducing the need for internet based cloud services
  • Control all the smart devices in your home from a central location
  • Connect smart devices in your home in order to trigger perform actions like: When there is motion in the hallway, turn on the light
  • Provide a single app (web or mobile) to control and manage all your smart devices

Home Assistant may not be the ‘silver bullet’ for every situation, but I am willing to say that it is unequivocally the best home automation solution available today (as of 2020). Anyone interested in taking the next step in home automation should consider Home Assistant. Stay tuned and in the near future we will be discussing how to get started using this great tool, and why it is (in my opinion) superior, but friendly with other alternatives like Hubitat, SmartThings, and HomeKit.

white and gray Google smart speaker and two black speakers
Photo by Sebastian Scholz (Nuki) on Unsplash

(Full disclosure: I was not paid or in any way incentivized to speak so highly of Home Assistant)

Post #1

Welcome to my first blog post! It won’t be impressive, so don’t get your hopes up. I don’t currently have a structured plan for this blog yet, but I need to start somewhere, so basically I will explain how you are able to read this post – note the terms in italics – these may be topics of future blog posts:

  1. You entered or clicked on a link with the URL of homegrowntechie.com
  2. Your device made a DNS query to find out that homegrowntechie.com is located at a specific IP Address
    • Hopefully you are not using Google DNS or your ISP’s DNS – more on this in a future post
  3. The DNS request returns my Public IP address because I’ve used a Dynamic DNS service to update my Domain Registrar with the public IP address your machine needs to access this website.
  4. Your machine requested this page by sending a GET request, but before you were able to read anything on this page your request was Routed through your home router (or cell tower) to your ISP’s network, and on through the Internet before finally reaching my router,
  5. After reaching my router, my router forwarded your GET request to a Self-Hosted NGINX Reverse Proxy which then forwarded your traffic to my Self-Hosted WebServer
  6. My WebServer is running WordPress which then responded to your GET request with this webpage.

The few steps above are a simplified version of what actually happened, but a good opportunity to throw out some terms (Italicized) that may be topics of future blog posts.

Thought of the day: “Why am I still using Gmail when I care about my own privacy?