FOSCAM presets

I have the cameras working and can control them in UI5. So all is happy there.

Now I’m trying to follow the above to move the camera to point towards the back door. I think i’ve done the LUA code correctly when the scene runs, it seems to pan left or whatever I tell it to do.

Im struggling with pre-sets though - I can’t see how to save a preset, there is a link on the camera control but that doesn’t seem to do anything and ive tried positing the camera and then going to

http://192.168.0.25/decoder_control.cgi?command=32 [nofollow]

for example, so does that save preset 1? Or is there a different approach?

When I try the scene with the command for a preset, the camera doesn’t move anywhere, which makes me think the presets aren’t saved.

This may help. http://forum.micasaverde.com/index.php/topic,3720.msg48216.html#msg48216

JOD.

hi Jod

Thanks for the reply, it’s that thread I originally started on. I can’t seem to set the presets on my camera, am i missing something on that thread that will help?

cheers
rich

am i missing something on that thread that will help?
All the relevant info is in that thread.

You can set the presets by saving the camera’s position via the camera’s software.
or
a few posts down on the above link, @m0jon shows how to save the preset via code.

decoder_control.cgi?command=32 = Set preset 1 decoder_control.cgi?command=34 = Set preset 2 decoder_control.cgi?command=36 = Set preset 3

JOD.

Hi Jod

Perhaps we can extract my questions from the original post

there is a link on the camera control but that doesn’t seem to do anything

and

[b] ive tried positing the camera and then going to

http://192.168.0.25/decoder_control.cgi?command=32 [nofollow]

for example, so does that save preset 1? Or is there a different approach?[/b]

So I can see the link on the web interface (using IE) but i’ve positioned the camera, and clicjked save Preset and it doesn’t seem to do anything. Or how would we use the code approach, through LUA?

Setting the preset from the camera’s web browser:

  1. Within the camera software (screen shot attached) position the camera, select the drop down arrow of the presets, click on preset 1 and click set.

To do the same as above (setting preset 1) within Vera the code would look like this:

local IP_address = ‘ip address here’
local username = ‘username here’
local password = ‘password here’
local timeout = 5

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

JOD.

I figured option one was that simple, and indeed mine isn’t working!

So the option in the settings to ‘disable preset’

Untick that and it works ;D

I’ve been working on getting the presets to work. I have them programmed, but I can’t seem to figure out how to make them work based on a scene.

For example:

  1. Lock button is pressed
  2. Rotate camera to Preset X
  3. Take an image
  4. After 1 minute, return to preset Y

I am assuming this takes some programming, since I can’t seem to find anything for the cameras when I create or edit a scene. I tried following the directions in [url=http://forum.micasaverde.com/index.php/topic,3720.msg50825.html#msg50825]http://forum.micasaverde.com/index.php/topic,3720.msg50825.html#msg50825[/url] to get a feel for it, but couldn’t seem to get it to work.

It looks so easy in the ad for Vera, where a text message pops up with an image when I door is opened :slight_smile:

Does anyone have any advice or good references for learning how to make this happen?

Thanks,
-Evan

1) Lock button is pressed
Add this to the luup tab of that scene.[code]local IP_address = 'ip address here' local username = 'username here' local password = 'password here' local timeout = 5

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

2) Rotate camera to Preset X
Change the command = number to the preset you want. Preset #1 = command=31 Preset #2 = command=33 Preset #3 = command=35 Preset #4 = command=37 Preset #5 = command=39 Preset #6 = command=41 Preset #7 = command=43 Preset #8 = command=45
3) Take an image
I'm not sure that Vera can do this.
4) After 1 minute, return to preset Y
I have mine change to a different preset when the door is locked, but adding a delay is a good idea! A scene could then be used to patrol a camera through various presets over a set period of time and repeat....

How would one add a delay in Luup? & how could a luup loop be created to repeat it? Anyone?

JOD.

Thanks JOD! I appreciate the help!

So, rather than a delay - my temporary solution was to create a scene that runs every hour - just in case I forget to put cameras back where they belong, it will move them to the preset I want to keep them at most of the time. But, when I lock/unlock doors there will be an instant focus on the doors.

Thanks again for the code- worked like a charm!
-Evan

[quote=“JOD, post:10, topic:170205”]Add this to the luup tab of that scene.[code]local IP_address = ‘ip address here’
local username = ‘username here’
local password = ‘password here’
local timeout = 5

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

Change the command = number to the preset you want.
Preset #1 = command=31
Preset #2 = command=33
Preset #3 = command=35
Preset #4 = command=37
Preset #5 = command=39
Preset #6 = command=41
Preset #7 = command=43
Preset #8 = command=45[/quote]

Perfect - was just looking for how to move to the presets. Thanks!

Any change to add a delay after the initial trigger before the luup code activates and starts moving the camera. Just in case there is more movement before returning.

[quote=“JOD, post:10, topic:170205”]Add this to the luup tab of that scene.[code]local IP_address = ‘ip address here’
local username = ‘username here’
local password = ‘password here’
local timeout = 5

luup.inet.wget( ‘http://’…IP_address…‘/decoder_control.cgi?command=31’ , timeout, username, password )[/code][/quote]

Just a note - I updated my FI8910W today to the latest firmware 11.37.2.65. Now the above code I have been using for the past three years stopped working. After a LOT of trial and error, I found this does work:

luup.inet.wget("http://YourIPAddress/decoder_control.cgi?command=33&user=YourUser&pwd=YourPassword")

Hoping to save someone else the trouble…