Hi guys,
I have a problem to integrate Motion Detection of my Foscam C1.
My configuration.yaml:
- platform: foscam
name: foscam1
ip: 10.0.X.X
username: #######
password: ########
It’s Ok with the entitie camera.foscam1 i see my foscam in the dashboard.
My problem is in Motion Detection integration, i use this code in a switches.yaml:
switch:
platform: command_line
switches:
foscam_motion:
command_on: 'curl -k "https://10.0.X.X:443/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=1&usr=#######&pwd=#######"'
command_off: 'curl -k "https://10.0.X.X:443/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=0&usr=#######&pwd=#######"'
command_state: 'curl -k --silent "https://10.0.X.X:443/cgi-bin/CGIProxy.fcgi?cmd=getMotionDetectConfig&usr=#######&pwd=#######" | grep -oP "(?<=isEnable>).*?(?=</isEnable>)"'
value_template: '{{ value == "1" }}'
It’s ok i see a new entitie switch.foscam_motion and this result in dashboard:
When I click on the button, it turns blue, it launches well the request “Turned on switch.foscam_motion.”
and he immediately goes back to the initial status. Off.
If I look in the webacces of the Foscam, the motion detection is activated.
why does not the switch stay on?
Hass.io Log Details (ERROR):
Command failed: curl -k --silent "https://10.0.X.X:443/cgi-bin/CGIProxy.fcgi?cmd=getMotionDetectConfig&usr=#######&pwd=########" | grep -oP "(?<=isEnable>).*?(?=</isEnable>)"
when I type in a browser:
https://10.0.X.X:443/cgi-bin/CGIProxy.fcgi?cmd=getMotionDetectConfig&usr=#######&pwd=########
I have this feedback:
<CGI_Result>
<result>0</result>
<isEnable>0</isEnable>
<linkage>140</linkage>
<snapInterval>3</snapInterval>
<sensitivity>1</sensitivity>
<triggerInterval>10</triggerInterval>
<isMovAlarmEnable>1</isMovAlarmEnable>
<isPirAlarmEnable>1</isPirAlarmEnable>
<schedule0>0</schedule0>
<schedule1>0</schedule1>
<schedule2>0</schedule2>
<schedule3>0</schedule3>
<schedule4>0</schedule4>
<schedule5>0</schedule5>
<schedule6>0</schedule6>
<area0>0</area0>
<area1>0</area1>
<area2>0</area2>
<area3>0</area3>
<area4>0</area4>
<area5>0</area5>
<area6>0</area6>
<area7>0</area7>
<area8>0</area8>
<area9>0</area9>
</CGI_Result>
isEnable=1 if my motion is activate
isEnable=0 if my motion is disable
What’s wrong with command_state ? no keep the statut ON in the dashboard.
Thanks for help