Using ZM API with a PTZ

Forum for questions and support relating to the 1.30.x releases only.
Locked
thefuzz4
Posts: 28
Joined: Sat Mar 01, 2014 5:43 am

Using ZM API with a PTZ

Post by thefuzz4 »

So reading through the doc I see that I can view all of the controls that the camera is capable of by going to curl http://server/zm/api/controls/5.json


But I would like to do something with my home automation. So using SmartThings I'm able to tell ZM thanks to its awesome API to force an alarm in certain areas based off of a door opening or something else. But what I would also like to do is say if my living room motion sensor detects motion, I want to be able to tell ZM to use the PTZ to pan to preset 2 record for like a minute then stop the recording and pan back to home position. I can tell from ZMNinja (Awesome app btw, hands down one of the best purchases I've ever made for my phone) that it is possible to control the camera through the API I just don't know what the appropriate API call would be to have it do this. Thank you all in advance for your help with this and I really do enjoy seeing where ZM is headed and I can't get rid of the zmodo cameras, and replace with IP fast enough.
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Using ZM API with a PTZ

Post by asker »

PTZ control is achieved by sending POST commands to zms, not via the API layer of ZM

Something like this: (where id = monitor ID, control is the ptz command sent to it)

Code: Select all

curl -X POST "http://server.com/zm/index.php?view=request" -d
        //"request=control&user=admin&passwd=xx&id=4&control=moveConLeft"
To figure out other ptzControl commands, either take look at monitors-modal.html code of zmNinja in templates/ & associated MonitorModalController.js in js/ or open up your ZM web console, go to PTZ controls, right click and inspect source.
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
thefuzz4
Posts: 28
Joined: Sat Mar 01, 2014 5:43 am

Re: Using ZM API with a PTZ

Post by thefuzz4 »

Thank you @asker for your help with this. I apologize for my delayed response was out in the woods all last week.
Locked