Search

Tuesday, September 6, 2011

Foscam / Opticam 8918w luup control code

 
How to control you camera from a scene. Add this to the Luup part of the scene:
local IP_address = 'xxx.xxx.xxx.xxx'
  local username = 'username'
  local password = 'password'
  local timeout  = 5
function move_right()
luup.inet.wget( 'http://'..IP_address..'/decoder_control.cgi?command=4' , timeout, username, password )
end
function stop_right()
luup.inet.wget( 'http://'..IP_address..'/decoder_control.cgi?command=5', timeout, username, password )
end

luup.call_delay( 'move_right', 5 )
luup.call_delay( 'stop_right', 37 )
 
Center:
http://IP:port/decoder_control.cgi?command=25
Pan Up:
http://IP:port/decoder_control.cgi?command=0
Pan Down:
http://IP:port/decoder_control.cgi?command=2
Pan Right:
http://IP:port/decoder_control.cgi?command=4
Pan Left:
http://IP:port/decoder_control.cgi?command=6
Patrol Up + Down:
http://IP:Port/decoder_control.cgi?command=26
Patrol Left + Right:
http://IP:port/decoder_control.cgi?command=28
Pan right: Again?
http://IP:port/decoder_control.cgi?command=39
IR Off:
http://xxx.xxx.xxx.xx/decoder_control.cgi?command=94
IR On:
http://xxx.xxx.xxx.xx/decoder_control.cgi?command=95
 
And the presets are:
URL commands for the PRESET function:
decoder_control.cgi?command=30&user=...&pwd=.... = Set preset 0
decoder_control.cgi?command=31&user=...&pwd=.... = Go preset 0
decoder_control.cgi?command=32&user=...&pwd=.... = Set preset 1
decoder_control.cgi?command=33&user=...&pwd=.... = Go preset 1
decoder_control.cgi?command=34&user=...&pwd=.... = Set preset 2
decoder_control.cgi?command=35&user=...&pwd=.... = Go preset 2
decoder_control.cgi?command=36&user=...&pwd=.... = Set preset 3
decoder_control.cgi?command=37&user=...&pwd=.... = Go preset 3
And the list goes further until preset 16
Presets can only be set from Internet Explorer and only if the disable preset under PTZ setting in the camera is enabled.





No comments:

Post a Comment