I picked up two Reolink RLC-411WS 4K cameras with Zoom/Focus for $125 from Amazon https://www.amazon.com/gp/product/B019MMAE3O and I found the user contribution here for Reolink. https://github.com/ZoneMinder/zoneminde ... Reolink.pm. However, this ONVIF method did not work on my camera.
So I implemented the Reolink API, which is used by their web interface, for the focus/zoom/reset capabilities on this device.
Features
- Zoom In Continuous
- Zoom Out Continuous
- Zoom Stop
- Focus near continuous
- Focus Wide continuous
- Focus Stop
- Reset Camera
Setup
Find the Perl Procedural Module here: https://pastebin.adamoutler.com/oKr0
Save the PM file as /usr/share/perl5/ZoneMinder/Control/ReolinkHTTP.pm
Control Compatibility: type:"FFMPEG", protocol: "ReolinkHTTP" options: "Can Reset" "Can Zoom", "Can Zoom Continuous", "Can Focus", "Can Focus Continuous"
Control Device: "userName":"admin","password":"" (Out-of-object JSON format "username":"my username","password","MYPASSWORD". These quotes are important. This is the only place you need the quotes in this post)
Control Address: 10.10.187.101 (the IP address)
About
This utilizes HTTP POST requests to send a JSON object to the device. I ran into problems at first because the web UI utilizes a token system in order to validate the requests. However, through experimentation I was able to find that you can send a JSON array such as [{login},{action}] to the device and it accepts the first packet as login and the second as a proper action.
Note: because this is sending a username and password with every request, you should use this only on a private network, or with HTTPS between the camera and the server. This is only slightly worse than basic auth, because basic auth at least base64s the username/password. This is a username and password in a plain-text packet
here is an example "ZoomInc" (zoom in) packet which zoneminder will send to cam.e.ra.IP/api.cgi?cmd=Login
Code: Select all
[{"cmd":"Login","action":0,"param":{"User":{"userName":"admin","password":""}}},{"cmd":"PtzCtrl","action":0,"param":{"channel":0,"op":"ZoomInc","speed":32}}]
Code: Select all
curl -d '[{"cmd":"Login","action":0,"param":{"User":{"userName":"admin","password":""}}},{"cmd":"PtzCtrl","action":0,"param":{"channel":0,"op":"ZoomInc","speed":32}}]' 10.10.187.102/api.cgi?cmd=Login
Code: Select all
[
{
"cmd" : "Login",
"code" : 0,
"value" : {
"Token" : {
"leaseTime" : 3600,
"name" : "0865a3fb928c189"
}
}
},
{
"cmd" : "PtzCtrl",
"code" : 0,
"value" : {
"rspCode" : 200
}
}
]