Foscam C1 as Sound and Motion Sensors in Zipabox

Tom Säll shared this idea 2 years ago
Under Consideration

Hi, i created a powershell-script to use the Sound and motion sensor on the Foscam as virtual devices so it can be used as a regular device in zipabox. If you got a more elegant solution for this please let me know.. :)

Things you need:

Zipabox

Foscam C1 (might work with other aswell),

Windows computer with Powershell 3 that runs 24/7 if you want your sensors to work all the time.


1. First log in to https://my.zipato.com

2. Open Devicebrowser and click Create new Device

3. Pick Virtual Device, then select Virtual Sensor. Type ex. vSoundsensor and hit Save.

4. Repeat step 2-3 and name the device vMotionSensor instead.

5. Go to the Device Manager or whats its called. the one below the Device Browser. Click on Virtual network and find one of the device you just created. Navigate down the hierachy in the device until you reach STATE. Click on Settings on the STATE

6. Copy the URL in the General-tab of the device and save somewhere on your computer

should look similar to https://my.zipato.com/zipato-web/remoting/attribute/set?serial=something&apiKey=something&ep=something&state=

7. Repeat step 5-6 with the other device you created.

8. Open up you favorite Powershell-editor and create a script with the following content:

while(1){

$current_timestamp=Get-Date -Format u

# change yourfoscamusername and yourfoscampassword

$cam1="http://XXX.XXX.XXX.XXX:88/cgi-bin/CGIProxy.fcgi?usr=yourfoscamusername&pwd=yourfoscampassword&cmd=getDevState";

$rawresult1=Invoke-WebRequest $cam1

[XML]$test1=$rawresult1.Content

if ($test1.CGI_Result.motionDetectAlarm -eq 1){

Invoke-RestMethod -uri "https://my.zipato.com/zipato-web/remoting/attribute/set?serial=something&apiKey=something&ep=something&state=false"; | Out-Null

}elseif ($test1.CGI_Result.motionDetectAlarm -eq 2){

Invoke-RestMethod -uri "https://my.zipato.com/zipato-web/remoting/attribute/set?serial=something&apiKey=something&ep=something&state=true"; | Out-Null

}

if ($test1.CGI_Result.soundAlarm -eq 1){

Invoke-RestMethod -uri "https://my.zipato.com/zipato-web/remoting/attribute/set?serial=something&apiKey=something&ep=something&state==false"; | Out-Null

}elseif ($test1.CGI_Result.soundAlarm -eq 2){

Invoke-RestMethod -uri "https://my.zipato.com/zipato-web/remoting/attribute/set?serial=something&apiKey=something&ep=something&state=true"; | Out-Null

}

Start-Sleep -Seconds 3

}


9a. Now start replace the http://XXX.XXX.XXX.XXX:88/cgi-bin/CGIProxy.fcgi?usr=yourfoscamusername&pwd=yourfoscampassword&cmd=getDevState

XXX.XXX.XXX.XXX:88 with the IP of your cam.

yourfoscamusername is the username to the local webui of your foscam

yourfoscampassword is the password to the local webui of your foscam

9b. replace the https://my.zipato.com/zipato-web/remoting/attribute/set?serial=something&apiKey=something&ep=something&state= URLs with the correct ones from your zipabox and add true of false in the end.

Save and run the script . motion and sound sensor will work until you stop the script. it checks the status every 3 seconds.

Comments (1)

photo
1

To bad its not supported directly from the box!


nice work by the way