ZoneMinder integration into SmartThings

I don’t know if anybody else out there is using ZoneMinder (Video security and surveillance on Linux), but I’ve written some code to trigger a camera to record if a SmartThings contact sensor or motion sensor is activated.

2 Likes

Nice job, big fan of ZoneMinder… I should test camera urls for images as well. Could actually use a trigger to record via ZoneMinder and then round trip the images to the image cache (on iOS only for now) via a caroselTile.

I’ve been a ZM user for about 3 years now and will be getting my ST hub on Monday. I was thinking of the opposite, when ZM senses motion have ST turn the lights on.

You can do that without the hub if you can control the light from your computer, ie command line. You can setup a filter in ZM to run a script on an alarm. I was doing this with my Hue lights before ST.

Hey @RobtheEngineer, I was curious if you still used this and if it worked well. I am looking at options for camera triggers via Smart Things and Zoneminder was pretty high on my list.

Thanks!

Nate

So just wanted to add onto this. If you’re using CORE and you have at least ZM 1.29 with the API’s setup and working you can now trigger multiple things to happen.

I have mine setup so that depending on the mode the house is in it will change the mode of zoneminder i.e. day/night/sleep/away

I also am using CORE to trigger zones to record based off of motion/contact sensors as well. Just thought I’d share this sorry to bring up an old thread.

For CORE you just have it use the hub to make a web method call then just put in the host and which api call to make and bang off it goes.

2 Likes

Do you have more information on this? Links to code or a howto?

So I’m now using WebCore for making calls back to ZM.

So for mode changes I make a call like this
With Location
Make a web request
To http://192.168..:80/zm/api/states/change/away.json (based on the different modes you have configured within zm)
Post
Form

Then I also do other calls like when one of my motion sensors detects motion based on current ST mode and time of day

Like if East Side Motion changes to active
Then
With Location
Make a web request
To http://192.168..:80/zm/api/monitors/alarm/id:9/command:on.json (The ID is your camera ID within ZM you can find this by just hovering your mouse over the zone and looking at the bottom of your browser) The command:on.json tells it to force a recording and it will show up in your events as a forced web.

Then I do an else if
East side motion changes to inactive
Then
With location
Make a web request
To http://192.168..:80/zm/api/monitors/alarm/id:9/command:off.json

Let me know if that makes sense and I’ll gladly help you with whatever you need to get this rolling. Now while the motion detection inside of ZM is great it is nice to be able to change the mode of ZM automatically and also do forced recordings.

I also do forced recordings like if one of my external doors opens up while in away/sleep mode and SHM is not disarmed.

Edit: Here is the link to the ZM api docs I know that there is more that you can do besides what is listed on this doc because I’m trying to figure out how to control my PTZ camera with it. https://zoneminder.readthedocs.io/en/stable/api.html

our NVR died. was looking for a quick /cheap fix

Have an old PC we used for XBMC and was going to install ZM on to play with

Does this code work with the latest version on ZM ?

thanks

I was also wondering if this still works? I want to do if both devices leave then set zoneminder to running state away then if either turns set running state back to home.

I have no idea how I’m the first person to mention this, but the code is truncated from Nano editor. Any chance you could replace this?

	2. Edit zmtrigger.pl and comment out the channels not used. Run the following in the terminal:
 *
 *		sudo nano /usr/bin/zmtrigger.pl
 *
 *		Find the my @connections under Channel/Connection Modules and make it look like this:
 *
 *		my @connections;
 *		push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan1", channe$
 *		#push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan2", chann$
 *		#push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan3", chann$
 *		#push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan4", chann$

bump - would love to get ZoneMinder and SmartThings talking to each other.

Hi everyone,
I was recently looking into switching from my old zoneminder installation to something more robust and better maintained.
Blue Iris doesn’t work natively on linux so not really on option to me.
Has anyone tested shinobi yet ? I am willing to give it a try…
Thanks

If you install smartthings_cli then you can run a script like this-

#!/bin/bash

# are the lights on?
result=$( /root/smartthings_cli/smartthings_cli.py query switch "Driveway Floods" 2>&1 )
if [[ ! $result =~ True ]] ; then
    # nope, turn them on
    /root/smartthings_cli/smartthings_cli.py set switch "Driveway Floods" on
fi

More info about smartthings_cli-

Rus

1 Like

@RobtheEngineer
Hi!
I have cameras (wansview) for which i wish to have the video stream inside smartthings new app.
Going with zoneminder would be the solution?