Page 1 of 1

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

Posted: Sunday 10 March 2019 0:17
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 ...

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

Posted: Sunday 17 March 2019 17:10
by PSUtec