Best way to set a cam position on sensor trip?

I have a PTZ cam on my front door with position presets set up.

Normally the cam position is set to watch over the porch area. I want the cam to move to the door view whenever this door is opened. This door has a sensor for my Elk alarm panel.

So when this sensor is tripped, the cam should move to the preset viewing the door. When the door sensor is reset, after 2 minutes it should go back to the porch view.

I suppose I should create a scene and add a luup statement to set position 1 (door) upon the sensor trip. Then move back to position 5 (porch). Assuming this is the best way, I need help to make this luup statement. I do not know how to write it.

Can someone help me with this statement? Or is there a better way to do this?

Thanks

Anyone providing help would need to know what type of camera(make/model) you are using.

Also, do you know how to control the camera manually. For example, is there a URL that you can enter to cause the camera to go to the desired preset, or can it only be controlled via a proprietary app form the manufacturer?

This is an IPUX ICS 2330 cam. I also run BI and via it’s GUI I can PT and go to presets. In Vera I use the Generic cam plugin and modifies a Dlink cam xml file so in Vera I have PT functions working. But no presets.

I am not aware of a URL call to control presets with this cam. I don;t have a cgi command list for this cam either.

I can also use IP CAM Pro on my iPad to view, and control PT and presets. On my Android, I use the BI client which also gives controls fine.

You’ll need to find the direct url call to set the preset on the camera or via BI. Than you can either modify the xml file or use a scene to call the preset.

  • Garrett

This is what I found searching the iSpy database for the URL.

/users/ptctl.cgi?move=p0

<Camera id="149"> <Makes> <Make Name="7Links" Model="RoboCam III" /> <Make Name="Airlink" Model="SkyIPCam 777 Series" /> <Make Name="Digitus" Model="DN-16025" /> <Make Name="Encore" Model="ENVCWI-Gx/PTGx" /> <Make Name="Activa" Model="ACT-2800/3100" /> <Make Name="IPUX" Model="ICS-1310" /> <Make Name="IPUX" Model="ICS-2330" /> <Make Name="QNAP" Model="ICS-1013" /> <Make Name="TRENDnet" Model="TV-IP121" /> <Make Name="TRENDnet" Model="TV-IP212 Series" /> <Make Name="TRENDnet" Model="TV-IP252 Series" /> <Make Name="TRENDnet" Model="TV-IP312 Series" /> <Make Name="TRENDnet" Model="TV-IP410 Series" /> <Make Name="TRENDnet" Model="TV-IP422 Series" /> </Makes> <CommandURL> </CommandURL> <Commands> <Center>/users/ptctl.cgi?move=h</Center> <Left>/users/ptctl.cgi?move=left</Left> <Right>/users/ptctl.cgi?move=right</Right> <Up>/users/ptctl.cgi?move=up</Up> <Down>/users/ptctl.cgi?move=down</Down> </Commands> <ExtendedCommands> <Command Name="Go Preset 1">/users/ptctl.cgi?move=p0</Command> <Command Name="Go Preset 2">/users/ptctl.cgi?move=p1</Command> <Command Name="Go Preset 3">/users/ptctl.cgi?move=p2</Command> <Command Name="Go Preset 4">/users/ptctl.cgi?move=p3</Command> <Command Name="Go Preset 5">/users/ptctl.cgi?move=p4</Command> </ExtendedCommands> </Camera>

Nice work AgileHumor. So there is some hope on this yet.

I’m thinking creating a scene is the best way to do this. Then I can easily use a door sensor trip to run the scene so it can change the cam preset.

SOooo, how would I go about writing this URL command? Sorry, but I’m nt being lazy. Spend hours trying to figure this out on my own with no luck.

[code]function HTTPGet(URL)
local status, result = luup.inet.wget(URL, 3)
end

HTTPGet(“http://myurl.com/wattsup”)[/code]

Replace “http://myurl.com/wattsup” with your URL.

PS - Authentication not included.

I’ve been trying your code in test luup without success. My cam needs authentication as well. Where does that go???

My example,
function HTTPGet(URL)
local status, result = luup.inet.wget(URL, 3)
end

HTTPGet(“http://ip:port/ptctl.cgi?move=p0”)

I’m sure I just don’t know exactly how to write this.

I finally get a “message sent successful” in test lua page with the following…

function HTTPGet(URL)
local status, result = luup.inet.wget(URL, 3)
end

HTTPGet(“rtsp://192.168.122.162:2117///ptctl.cgi?move=p0”)

However my cam does not move. Any ideas now?

http://myuser:mypass@myurl.com/wattsup

Since I cannot get this to work (my cam will not move), I wanted to try a different approach.

If I put “http://192.168.122.xxx:xxx/cgi/admin/ptctrl.cgi?action=move&Cmd=Position1” in a browser tab, my cam works fine. It moves to the preset.

So how can I use this exact request in a scene? The previous luup code did run, but it did not move my cam.

Note: I apparently do not need authentication for this to work.

  1. Create a scene X
  2. Go to the LUUP tab in the scene.
  3. Paste in this code and click “Save LUA”
function HTTPGet(URL)
     local status, result = luup.inet.wget(URL, 3)
end

HTTPGet("http://192.168.122.xxx:xxx/cgi/admin/ptctrl.cgi?action=move&Cmd=Position1")
  1. Optional - Create trigger for scene X (i.e. motion detector 1 is tripped). Otherwise, you need to run the scene manually.

First, thank you much, AgileHumor, for working with me on this.

I did exactly as you posted and manually ran the scene. Still no cam movement. If I put this into Test Luup code, it runs and comes back Message sent successfully. But still no movement. Again, it does work instantly when done in a browser (Chrome).

This is very strange it does not work in Vera.

FYI, I have it working fine now for my IPUX cam. The solution is…

function HTTPGet(URL)
local status, result = luup.inet.wget(URL, 3)
end

HTTPGet(“http://<user>:<PW>@192.168.xxx.xxx:2117/cgi/admin/ptctrl.cgi?action=move&Cmd=Position1”)

Set up a scene with this code and used PLEG to trigger it.