Adjust Foscam FI9826P camera position when one of the doors is opened

Hi HA gurus,

I have Foscam FI9826P camera with PTZ function connected to my vera edge UI7 (latest update) with Foscam HD app. I positioned my camera so I can see my front door as well as door which leads to my garden.

In foscam I’m able to set the preset, in my case the preset 6 means camera positions it self to watch the front door and the preset 7 positions camera to monitor the garden door.

Both doors have fibaro door sensors.

So this is what I would like achieve:

When front door is opened send command to my camera to go to preset 6 and start recording.(camera will turn to left)

When garden door is opened send command to my camera to go to preset 7 and start recording.(camera will turn to right )

Any ideas how is this could be accomplished? I believe this will involve some coding and I’m really struggling with it…

Thanks in advance.

Here you go…

I have this code in a scene that is run when the back door opens in a non-home mode…

local status, result = luup.inet.wget(‘http://[camera_ip]:[camera_port]/cgi-bin/CGIProxy.fcgi?cmd=ptzGotoPresetPoint&name=BackDoor&usr=[user_name]&pwd=[user_password]’)

My preset is just named ‘BackDoor’ - you’ll need to change that value to whatever you named yours (from the sound of it, 7, but you can use more descriptive names in the web interface)

You’ll also need to change the camera_ip and port values to fit your camera.

I use the code to look at the doors if anything gets tripped, as it can see the front and back door from where it sits. I also have a ‘TopMost’ preset that I send the camera to when we’re home, so it’s not sitting there staring at us when it doesn’t need to be.

Hope that helps!

Hi ceefin, thanks for the reply,

just tried your code, changed the IP Port added my username and pswd, specified the preset name but for some reason nothing happens, below in red is what i have changed.

I have tried to run code manually in “Test Luup code (Lua)” as well as in a scene but specified to run in any mode instead of only away but still nothing happens.

local status, result = luup.inet.wget('http://[[glow=red,2,300]camera_ip[/glow]]:[[glow=red,2,300]camera_port[/glow]]/cgi-bin/CGIProxy.fcgi?cmd=ptzGotoPresetPoint&name=[glow=red,2,300]BackDoor[/glow]&usr=[[glow=red,2,300]user_name[/glow]]&pwd=[[glow=red,2,300]user_password[/glow]]')

Am I doing something wrong? Any ideas why it is not working?

Also just to clarify my camera is connected through wifi, but i assume this shouldn’t make any difference.

I have also attached the screenshot of my scene.

Thanks for your help.

Take out the [ & ] characters. I used those to block in the parts that needed changed.

Hi ceefin,

Excellent works like a charm. Thank you very much for your help, I new it is something stupid that I have missed.

Last question, how about the Zoom in and Zoom out function is this something we can control through vera? If so, would you be so kind to post a code for that as well.

Thanks in advance.

There is a zoomIn command, but it looks like it’s going to zoom to the maximum setting?

http://[camera_ip]:[camera_port]/cgi-bin/CGIProxy.fcgi?cmd=zoomIn&usr=[user_name]&pwd=[user_password]

The opposite is zoomOut.

There are some other commands that allow you to set the zoom speed and stop the zooming, which presumably would allow you to set the zoom speed to slow, tell the camera to start zooming in, then after X number of milliseconds, tell the thing to stop. That’s beyond the scope of my experience, but something you can experiment with if you want.

I’m using this file as a reference: http://www.ipcamcontrol.net/files/Foscam%20IPCamera%20CGI%20User%20Guide-V1.0.4.pdf

It gives you examples similar to how I have done as well.

Hello Ricardasr25 and GURU’s

I got the FI9826P aswell and got it to work in my Vera Edge
I used the files:
device_file = D_DigitalSecurityCamera2.xml
device_json = D_DigitalSecurityCamera2.json

And I got picture Yeah but when i use the code:

local status, result = luup.inet.wget('http://xxx.xxx.x.xxx:xx/cgi-bin/CGIProxy.fcgi?cmd=ptzGotoPresetPoint&name=Achterdeur&usr=[Username]&pwd=[password]')

in the Advanced Editor and save the scene the I get an Error in lua for scenes and events and it does not work.
How did you guys got this to work.
I’m also looking for a code/scene to turn the cam towards the frontdoor or backdoor when trigger a or b is triggert. Please help me to get this to work.

[quote=“Totalremote, post:7, topic:189687”]And I got picture Yeah but when i use the code:

local status, result = luup.inet.wget('http://xxx.xxx.x.xxx:xx/cgi-bin/CGIProxy.fcgi?cmd=ptzGotoPresetPoint&name=Achterdeur&usr=[Username]&pwd=[password]')

Are you including the [] in the code? I just used those as placeholders. Assuming your username was user1 and your password was abc123, the code should look like this:

local status, result = luup.inet.wget('http://xxx.xxx.x.xxx:xx/cgi-bin/CGIProxy.fcgi?cmd=ptzGotoPresetPoint&name=Achterdeur&usr=user1&pwd=abc123')

As for your code/scene, you’ll want to set it up as a scene based on an event (e.g., front door opening, back door opening), then include the above wget call to the camera to tell it which preset point to go to in the scene’s luup code definition area.

Hope that helps!

[quote=“ceefin”][quote=“Totalremote, post:7, topic:189687”]And I got picture Yeah but when i use the code:

local status, result = luup.inet.wget('http://xxx.xxx.x.xxx:xx/cgi-bin/CGIProxy.fcgi?cmd=ptzGotoPresetPoint&name=Achterdeur&usr=[Username]&pwd=[password]')

Are you including the [] in the code? I just used those as placeholders. Assuming your username was user1 and your password was abc123, the code should look like this:

local status, result = luup.inet.wget('http://xxx.xxx.x.xxx:xx/cgi-bin/CGIProxy.fcgi?cmd=ptzGotoPresetPoint&name=Achterdeur&usr=user1&pwd=abc123')

As for your code/scene, you’ll want to set it up as a scene based on an event (e.g., front door opening, back door opening), then include the above wget call to the camera to tell it which preset point to go to in the scene’s luup code definition area.

Hope that helps![/quote]
I did not use de [ ] in the code.
I got an scene set up where a sensor triggers when opening a door
Then as action the cam takes a picture
And finisch the scene with a luup code like this code.
But nothing . No motion

Verstuurd vanaf mijn SM-N915FY met Tapatalk

Hi Totalremote,

Before assigning it to the scene, I would suggest to test the code, just go to Apps>Develop apps>Test Luup code.

Copy and paste your code into the empty box and then press GO. If it works there it will work in a scene.

Otherwise only suggestion i may have is to double check the IP address and the whole code as you could miss the apostrophe and it will not work.

Just to outsource all options, hopefully you have put in your IP code instead of the xxx.xxx.x.x:xx one like this 194.166.1.10:99

Just please don’t be offended it may sound stupid, but you would be surprised…

Hope you have already managed to sort it out.

Hi Ricardasr25

I got all the code right including the right IP, port, username and password. and no I’m not offended I now how easy this mistakes are made :wink:
But still not luck, also now the app FoscamHD keeps hanging. In the blue line on the top of the screen the text FoscamHD : Starting up… is not starting right.

So mabye that’s the thing. of the Vera Support it is thne :frowning:

Thanks for the reply.
Maurice

Hi Totalremote,

Mine app seems to work absolutely fine, I’m on Vera_Edge UI7 latest January update.

FoscamHD app version 1.1, do you still get the video through vera interface?

Same here.
Same UI7 from january and foscamHD app 1.1 and yes also got a video feed through the vera interface. Asked vera support to remove the foscamHD app because this keeps running although I removed the app. Strange thing.

Verstuurd vanaf mijn SM-N915FY met Tapatalk

Also, did you followed the below instructions after installing the Foscam HD app to vera?

Foscam HD Camera Plugin

This plugin adds support for pan, tilt and presets. This plugin is suitable for all the HD cameras, including FI9821W, FI9818W, FI9801W, FI9802W and FI9805W.

Motion sensor support could not be added because the API does not allow HTTP notification. ​http://foscam.us/forum/notify-http-on-alarm-missing-feature-fi9805w-t6760.html

Instalation

Install your camera manually selecting “Other Ip Camera” and introduce the following URL when requested :
CAMERA_IP/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=YOUR_USERNAME&pwd=YOUR_PASSWORD

Wait for the camera to be added;
Instal the plugin;
In “Advance settings” add “I_FoscamHD.xml” in “impl_file” input field;
Reload LuaUPnP engine.

Yes did it.
I’m beginning to think mabye it’s the firmware of the ip cam. It’s been 5 months sinds you got it to work. Can you tell me your firmware version of the cam please.

Verstuurd vanaf mijn SM-N915FY met Tapatalk

Just updated mine recently:

System Firmware ver 1.5.3.16
Application firmware ver. 2.21.2.23
Plug-in ver 3.3.0.20

Looks like i’m running a bit behind.
Will update tomorrow mabye that works.
Thanks for now will let you know if I got it to work.

Maurice @ www.totalremote.nl

Got it to work
First total reset of the cam then made an 2nd user in de cam with operator rights.
Also activated the vera wifi network and connected the cam on that network instead of the home wifi network.
Now the luup code works fine.
2 sensors - front/backdoor - makes the cam turn towards the doors when tripped. Thanks fot the help.

Maurice @ www.totalremote.nl