Page 1 of 1

Enable/disable monitor via script

Posted: Thu Sep 14, 2023 10:47 pm
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

Re: Enable/disable monitor via script

Posted: Fri Sep 15, 2023 7:44 pm
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"

Re: Enable/disable monitor via script

Posted: Fri Sep 15, 2023 9:39 pm
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?

Re: Enable/disable monitor via script

Posted: Sat Sep 16, 2023 6:38 am
by Magic919
There are docs for the API if you want to dig in https://zoneminder.readthedocs.io/en/stable/api.html

Re: Enable/disable monitor via script

Posted: Sat Sep 16, 2023 8:31 pm
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.