I think I’ve got this figured out. My problem is that I don’t know what i am doing.lol. I spent the day turning an old windows 7 pc into an ubuntu server. Took me about 6 hours to configure samba and ftp. I kept messing up the user accounts and file permissions. Plus I found a setting i needed after many hours of searching. UGH!!! Massive headache after all that to get the cameras ftp’ing to the new server.
So I’m now trying turn on and off the foscam motion detect save video/pics/send email so it only takes action when I “arm” the camera through openhab. This lets me have my own little house wide video security system controlled through openhab. This could be done through a schedule or a swtich. I have an rfid tag near the door that I tap my phone on to “arm/disarm” my system when i leave or get home. After my whole house audio project I plan to use squeezespeak to audibly tell me the system status. I keep the motion detect on at all times but just turn the actions off. This is so i can have sitemap items that show if motion is currently being detected even if save to video is off. I also display the last motion detect date/time on my sitemap. I also poll the camera through a number item so i can verify that the camera received and accepted the command to arm/disarm using getMotionDetectConfig.
So this is my item for all of you with a foscam cam. Maybe it will save someone some headaches.
This switch turns the motion detect action on the camera on/off… with full schedule and full camera area.
The linkage parameter sets what action to take when motion is detected. I set it to 12 to send video and snap shots to the ftp server and 0 to take no action. I dont check email that much anymore so i don’t use that option. I have email setup in openhab and have openhab text me when i am away from home (i setup asus merlin script on my router to detect presence and have it update openhab when i connect/disconnect through wifi).
Each schedule interval is per day so there are 7 (schedule0-schedule6). There is one bit for every 30 minutes of the day.There are 48 per day so the value is 281474976710655 to cover the entire day.
The cams have a 10 by 10 grid for motion detection. it uses area0-area9 for each row I have all grids turned on so the value is 1023.
Switch setCam1Alarm “Set Motion Detect Action On/Off” {http=">[ON:POST:http://ip address:port/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=1&linkage=12&snapInterval=2&sensitivity=1&triggerInterval=10&schedule0=281474976710655&schedule1=281474976710655&schedule2=281474976710655&schedule3=281474976710655&schedule4=281474976710655&schedule5=281474976710655&schedule6=281474976710655&area0=1023&area1=1023&area2=1023&area3=1023&area4=1023&area5=1023&area6=1023&area7=1023&area8=1023&area9=1023&usr=xxxxx&pwd=xxxxx] >[OFF:POST:http://ip address:port/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=1&linkage=0&snapInterval=2&sensitivity=1&triggerInterval=10&schedule0=281474976710655&schedule1=281474976710655&schedule2=281474976710655&schedule3=281474976710655&schedule4=281474976710655&schedule5=281474976710655&schedule6=281474976710655&area0=1023&area1=1023&area2=1023&area3=1023&area4=1023&area5=1023&area6=1023&area7=1023&area8=1023&area9=1023&usr=xxxx&pwd=xxxx]"}
Here is the item i used to check if the camera received the updates. Sometimes with http it doesnt always work perfectly (timeouts, etc). So I display this item to make sure the cam is set properly. I use a map file to display if armed or disarmed.
Number nCheckCam1Alarm “Verification [MAP(onoffcam.map):%d]” { http="<[http://ip address:port/cgi-bin/CGIProxy.fcgi?cmd=getMotionDetectConfig&usr=xxxx&pwd=xxxx:4000:REGEX(.?(.?).*)]" }
edit…
The above item REGEX statement should read
REGEX(.?linkage(.?)/linkage.*)
with the word linkage enclosed by “<>” in both cases.
Large angry rant ahead:
The REGEX statement above does not come out as expected on these forums. This explains why many of the examples i’ve gotten off these forums do not work. The html messes up the actual statement. Does anyone have any ideas how to fix this? I’ve literally spent hours and hours trying to use REGEX examples from here only to find they dont work. Its extremely frustrating. It’s originally why i posted here as I couldnt get examples to work that other have said were working fine on their system. Most times I dont even think the original poster knows it has done this. This is one of the reasons why newbies like myself get so angry with openhab. We are told to read the examples, do a search etc. Fixing this or knowing this would have saved me days of work!!! I think if we want new people to give openhab a shot then we should find a way to change this. I am not a programmer and have been learning as i go. its been long and slow but i’m getting there. its a great program but i completely understand why many people give up on it. Do we want openhab to be only used by programmers? my 2 cents as a newb.
Rant over.
…end edit
The easiest way to get the values you want is to run the getMotionDetectConfig from the address line on your browser. Make sure you’ve set up the schedule the way you want and the areas to detect motion at. You have to do this from a browser or program that can access the native config for the camera (yes, the dreaded foscam plugins). I use IE and just login into the cam using its ip address:port
So after its all set up the way you want run:
http://ip adress:port/cgi-bin/CGIProxy.fcgi?cmd=getMotionDetectConfig&usr=xxx&pwd=xxx
Take the values from this and plug them into the item binding above and enjoy!!!
Now that my cams are working my next todo is to add squeeze server to my new ubunto server and start on the whole house audio project!!! Fun times! Anyone with some pointers (ex: STOP NOW , RUN AWAY!) would be helpfull.
Kim