Start/Stop button script?

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
TruckerDave
Posts: 15
Joined: Thu Mar 21, 2024 11:39 am

Start/Stop button script?

Post by TruckerDave »

Anyone know of a script that one can add to a custom php file that allows one to stop and start ZM?

I have a php file that I run on the ZM server that shows my feeds full screen on my monitor. It also changes the selected camera every 5 seconds and plays a fairly loud audible noise when an "alarm" is activated.

I know I could simply close up the window and load up the ZM page and stop/start there. But it would be nice to be able to just click a button with a mouse whenever I have to go out and mow the yard or whatever. Mowing adds over 100 extra recordings (I have 3+ acres and forgot to turn it off :D ).
TruckerDave
Posts: 15
Joined: Thu Mar 21, 2024 11:39 am

Re: Start/Stop button script?

Post by TruckerDave »

Nevermind. I came up with my own way to accomplish my goal using a couple of bash scripts. Not perfect. But it'll do.
vrm42z
Posts: 14
Joined: Sat Apr 11, 2020 4:55 pm

Re: Start/Stop button script?

Post by vrm42z »

Instead of stopping ZM fully you can control monitors individually so the rest can continue to do their jobs.
You can execute this from php:
curl -XPOST http://<IP>/zm/api/monitors/<monitor>.json -d "Monitor[Function]=Modect&Monitor[Enabled]=1"
This turns monitor funcion on for the selected camera.
Later you can switch back to recording (Monitor[Function]=Record&Monitor[Enabled]=1) or whatever you want.
Also you can schedule the desired default function in case you forget to do that manually.
I use 1.34.x so API might have changed a bit.
Post Reply