Lorex NVR and PTZ question

s3rp1c0

n3wb
Joined
Mar 8, 2023
Messages
4
Reaction score
2
Location
Canada
Hi there,

I've got a Lorex N845A6 with a couple wired and wireless cameras connected. Everything is working great but but am trying to figure out how to remotely control a 2K PTZ camera (Lorex model: W462AQC). It's for the Twitch stream for my daughter's goat house and its a small space and want her to remotely control the PTZ presents via chat. That's the plan anyways lol

What I've tried:
- You can set the PTZ preset in the web interface so tried to look at POST headers to see what commands it sends to the wifi camera using Chrome's developer tools I see stuff like this for payload:

{"method":"configManager.getConfig","params":{"name":"Ptz","onlyLocal":false},"id":268,"session":"636c22dd852781bbdfbb49aaeed1c68e"}
and
{"method":"ptz.factory.instance","params":{"channel":3},"id":269,"session":"636c22dd852781bbdfbb49aaeed1c68e"}:

- I've tried using Python's ONVIF scripts to connect to the camera and the NVR but only get a response from the NVR.

- Tried to see what ports are open to see if something can be done that way (80, 554, 8086, are open) but not sure how to go forward from there.

Questions:
  • It seems like the NVR itself is Onvif compatible. Is there a way to ask it PTZ commands and have it reference a certain camera/channel or do PTZ commands have to be sent to the camera directly?
  • Does anyone know what port 8086 on the wifi camera is used for and could it be of any use?
  • Are there any good Linux ONVIF "sniffing" tools out there I could crawl the camera with?

I can remotely control PTZ through the Lorex NVR interface and it's over HTTP somehow so seems like I'm at least 1% there lol. I don't have any real expertise in this so any help or a pointing in a general direction would be super appreciated!

Tom
 

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
16,703
Reaction score
38,879
Location
Alabama
Here's a gamble, won't cost you much but a little time.
I think Dahua is the OEM for that camera. If it is there's a slight chance that the Dahua API will work.

The following HTTP URL works with my Amcrest IP2M-841 and commands it to go to preset #2 which was set up in the cam via its webGUI earlier. It is arg2 that calls up the preset number, so with "arg2=2" in the following URL and I hit <enter>, the cam moves to preset #2; with it it set to 1, it goes back to preset 1, and so on. When the command is valid, the cam reports back on the browser screen with "OK" and if not, it replies with "Error Bad Request!"

Code:
http://camera-username:camera-password@camera-IP/cgi-bin/ptz.cgi?action=start&channel=1&code=GotoPreset&arg1=arg2=2&arg3=0
Put in your cam's user/pass and IP and try it and if it works (be sure to have a couple of presets already set), I can attach the rest of the API in PDF form and you can see what what other PTZ commands in the API work for that cam.
 
Last edited:

s3rp1c0

n3wb
Joined
Mar 8, 2023
Messages
4
Reaction score
2
Location
Canada
Hi TonyR, thanks for the suggestions.. it got me on the track and we got this one figured out. Turns out Curl is a good way to test things and got it working using:

curl --digest -u "user:pass" "http://IP_ADDRESS/cgi-bin/ptz.cgi?action=start&channel=4&code=GotoPreset&arg1=0&arg2=1&arg3=0"

Works awesome.. just hit the NVR and you can control any channel and preset. I worked it into PHP so I can issue commands from Twitch via Firebot. Works exactly as I wanted :)

$ch = curl_init();
curl_setopt($ch, CURLOPT_USERPWD, "user:pass");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_URL, 'http://IP_ADDRESS/cgi-bin/ptz.cgi?action=start&channel=4&code=GotoPreset&arg1=0&arg2=3&arg3=0');
$response = curl_exec($ch);
curl_close($ch);

Hopefully it can be of use to someone else is stuck with PTZ and the cheap Lorex/Dahua cameras...
 

DRACONi

n3wb
Joined
May 3, 2023
Messages
2
Reaction score
1
Location
Ohio
Here's a gamble, won't cost you much but a little time.
I think Dahua is the OEM for that camera. If it is there's a slight chance that the Dahua API will work.

The following HTTP URL works with my Amcrest IP2M-841 and commands it to go to preset #2 which was set up in the cam via its webGUI earlier. It is arg2 that calls up the preset number, so with "arg2=2" in the following URL and I hit <enter>, the cam moves to preset #2; with it it set to 1, it goes back to preset 1, and so on. When the command is valid, the cam reports back on the browser screen with "OK" and if not, it replies with "Error Bad Request!"

Code:
http://camera-username:camera-password@camera-IP/cgi-bin/ptz.cgi?action=start&channel=1&code=GotoPreset&arg1=arg2=2&arg3=0
Put in your cam's user/pass and IP and try it and if it works (be sure to have a couple of presets already set), I can attach the rest of the API in PDF form and you can see what what other PTZ commands in the API work for that cam.
Hi Tony,

We are in need of the rest of the API, can you please post the PDF.

Thank you!
Rick
 
Top