Motion or sound detection on a Foscam IP camera with the API - CGI

Moderator: leecollings

Post Reply
cyberbob69
Posts: 9
Joined: Monday 05 June 2017 15:08
Target OS: NAS (Synology & others)
Domoticz version:
Location: belgium
Contact:

Motion or sound detection on a Foscam IP camera with the API - CGI

Post by cyberbob69 »

Hello,

When sending the following command in a browser to his Foscam camera:

Code: Select all

http://192.168.1.xx:xx/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=xxxxx&pwd=xxxxx
We receive the following answer:

Code: Select all

<CGI_Result>
    <result>0</result>
    <IOAlarm>0</IOAlarm>
    <motionDetectAlarm>1</motionDetectAlarm>
    <soundAlarm>1</soundAlarm>
    <record>0</record>
    <sdState>0</sdState>
    <sdFreeSpace>0k</sdFreeSpace>
    <sdTotalSpace>0k</sdTotalSpace>
    <ntpState>1</ntpState>
    <ddnsState>0</ddnsState>
    <url>http%3A%2F%2Flg3102.myfoscam.org%3A85</url>
    <upnpState>0</upnpState>
    <isWifiConnected>0</isWifiConnected>
    <wifiConnectedAP></wifiConnectedAP>
    <infraLedState>1</infraLedState>
    <humanDetectAlarmState>1</humanDetectAlarmState>
</CGI_Result>
In the response, the lines "<motionDetectAlarm> 1 </ motionDetectAlarm>" and "<soundAlarm> 1 </ soundAlarm>" are interesting because the variable changes from "1" to "2" when motion or sound is detected.

With the command curl in a script in LUA in domoticz:

Code: Select all

os.execute('curl "http://192.168.1.xx:xx/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=xxxxx&pwd=xxxxx"')
We can also send the command, but I do not find how to put the 2 lines "<motionDetectAlarm> 1 </ motionDetectAlarm>" and "<soundAlarm> 1 </ soundAlarm>" in a variable to change a virtual inter in domoticz?

Would be really convenient to do some scenario in case of alarm.
If you have any ideas ...
Domoticz Stable V4.9700 on Synology DSM 6.2 / 2xRFlink V48.4 - 433.92 & 433.42 MHz / Script in LUA & Blocky
PSUtec
Posts: 14
Joined: Sunday 11 November 2018 12:25
Target OS: Linux
Domoticz version: 12896
Location: Ferrières (BE)
Contact:

Re: Motion or sound detection on a Foscam IP camera with the API - CGI

Post by PSUtec »

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest