Enable/disable monitor via script

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
fluffykeith
Posts: 14
Joined: Wed Jun 07, 2023 3:11 pm

Enable/disable monitor via script

Post by fluffykeith »

Hi

doc says "...camera to be enabled or disabled by external triggers or scripts."

I have seen mention of x10 enabling monitors. Is this the only way or is there some way I can enable/disable monitors using Python?

When I say enable disable I really mean enable/disable motion detection as I still want the monitor working as just a monitor.

thanks
Keith
geraldbrandt
Posts: 139
Joined: Tue Dec 09, 2014 10:20 pm

Re: Enable/disable monitor via script

Post by geraldbrandt »

I have a single line in my crontab:

# Start monitoring on Monitor 3
0 22 * * * root /usr/bin/curl -XPOST http://localhost/zm/api/monitors/3.json -d "Monitor[Function]=Modect&Monitor[Enabled]=1"

# Stop monmitoring on monitor 3
0 6 * * * root /usr/bin/curl -XPOST http://localhost/zm/api/monitors/3.json -d "Monitor[Function]=Monitor&Monitor[Enabled]=1"
fluffykeith
Posts: 14
Joined: Wed Jun 07, 2023 3:11 pm

Re: Enable/disable monitor via script

Post by fluffykeith »

That's great, Thank you.

I guess that html post is what happens when we change the settings on the monitor settings pages. So the same mechanism could be used to change anything?
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Enable/disable monitor via script

Post by Magic919 »

There are docs for the API if you want to dig in https://zoneminder.readthedocs.io/en/stable/api.html
-
geraldbrandt
Posts: 139
Joined: Tue Dec 09, 2014 10:20 pm

Re: Enable/disable monitor via script

Post by geraldbrandt »

fluffykeith wrote: Fri Sep 15, 2023 9:39 pm That's great, Thank you.

I guess that html post is what happens when we change the settings on the monitor settings pages. So the same mechanism could be used to change anything?
Those lines use the Zoneminder API.
Post Reply