Foscam Reboot Luup?

I would like the ability to reboot my Foscam Camera’s occasionally. I see that this can be done through http requests by doing the following:

'http://ipaddress/reboot.cgi?user=admin&pwd=password'

Could this be issued as Luup code to accomplish the reboot through a scene?

I have tried modifying the code I currently have to move the camera to a preset but that didn’t seem to work.

local IP_address      = '192.168.xxx.xxx'
local username        = 'admin'
local password        = 'password'
local timeout         = 5

luup.inet.wget( 'http://'..IP_address..'/reboot.cgi?' , timeout, username, password )

Thanks for your help.

Ok. I figured it out.

Here is the code that worked for me.

luup.inet.wget( 'http://ipaddress/reboot.cgi?&user=admin&pwd=password')

Of course replace the ipaddress, user and password values for the actual camera configuration values.

Hello,

On site through a browser I can succesfully turn off the IR LEDs on a FOSCAM camera by entering

http://192.168.0.115/decoder_control.cgi?command=94

Based on this thread (and others) I would think by entering this in a scene LUUP code window that I could do this remotely

luup.inet.wget( ‘http:// /192.168.0.115/decoder_control.cgi?command=94&user=admin&pwd=’)
or
luup.inet.wget( ‘http://192.168.0.115/decoder_control.cgi?command=94’)

But I am missing something obvious (i’m not a programmer, well I was 30 years ago…)
I get a “Error in lua for scenes and events” message

Please help, I have spent many hours going through the forum but just can’t figure out what I am doing wrong
this site is on an older vera 2 with the older UI (over 50 devices…)

Richard.

[quote=“richard_canada, post:3, topic:173123”]Hello,

On site through a browser I can succesfully turn off the IR LEDs on a FOSCAM camera by entering

http://192.168.0.115/decoder_control.cgi?command=94

Based on this thread (and others) I would think by entering this in a scene LUUP code window that I could do this remotely

luup.inet.wget( ‘http:// /192.168.0.115/decoder_control.cgi?command=94&user=admin&pwd=’)
or
luup.inet.wget( ‘http://192.168.0.115/decoder_control.cgi?command=94’)

But I am missing something obvious (i’m not a programmer, well I was 30 years ago…)
I get a “Error in lua for scenes and events” message

Please help, I have spent many hours going through the forum but just can’t figure out what I am doing wrong
this site is on an older vera 2 with the older UI (over 50 devices…)

Richard.[/quote]

I played around a bit and found this to work. Code 95 turns the IR ON, Code 94 turns the IR OFF (At least on my Foscam(s)).

Replace the local password = ‘password’ value with your actual password.

Give it a shot:

IR ON

local IP_address = ‘192.168.0.115’
local username = ‘admin’
local password = ‘password’
local timeout = 5

luup.inet.wget( ‘http://’…IP_address…‘/decoder_control.cgi?command=95’ , timeout, username, password )

IR OFF

local IP_address = ‘192.168.0.115’
local username = ‘admin’
local password = ‘password’
local timeout = 5

luup.inet.wget( ‘http://’…IP_address…‘/decoder_control.cgi?command=94’ , timeout, username, password )

*EDIT: I added a feature request to add this capability to the Advanced function of Scene creation.

http://bugs.micasaverde.com/view.php?id=2852

Thanks Knewmania, your code worked perfectly !

Richard.

Excellent. Glad it worked.

Now it looks like you need to stop tinkering with the Foscam and start shoveling. LOL.

use this to turn the foscam links into a luup function [url=http://forum.micasaverde.com/index.php/topic,3720.msg50825.html#msg50825]http://forum.micasaverde.com/index.php/topic,3720.msg50825.html#msg50825[/url]

foscam_control(device,command,time-out)

so… in advanced scene luup :
using IPCAM device 52

turn on IR : foscam(52,95,5)
off IR : foscam(52,94,5)

Preset #1 = command = 31 = foscam(52,31,5)
Preset #2 = command = 33 = foscam(52,33,5)
Preset #3 = command = 35 = foscam(52,35,5)
Preset #4 = command = 37 = foscam(52,37,5)
Preset #5 = command = 39 = foscam(52,39,5)
Preset #6 = command = 41 = foscam(52,41,5)
Preset #7 = command = 43 = foscam(52,43,5)
Preset #8 = command = 45 = foscam(52,45,5)
Set Preset #1 = command = 32 = foscam(52,32,5)
Set Preset #2 = command = 34 = foscam(52,34,5)
Set Preset #3 = command = 36 = foscam(52,36,5)
Set Preset #4 = command = 38 = foscam(52,38,5)
Set Preset #5 = command = 40 = foscam(52,40,5)
Set Preset #6 = command = 42 = foscam(52,42,5)
Set Preset #7 = command = 44 = foscam(52,44,5)
Set Preset #8 = command = 46 = foscam(52,46,5)

I’m trying to reboot my foscam and I have used the suggested luup luup.inet.wget( ‘http://ipaddress/reboot.cgi?&user=admin&pwd=password’)

But it’s not working. I have copied the http link into my browser with the correct user and password but I get web page can not be displayed even though it’s added to trusted sites

Can someone help if I have to add or modify anything to make the link work?