Since the foscam integration doesn’t create those sensors (as far as I know…) the only way I know to do it is to use the CGI commands for the various cameras to get the data.
here is what I use to get the motion detection status of one of my Foscam cameras:
sensor:
- platform: command_line
command: curl -k --silent "http://192.168.1.58:88/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=<my_cam_user>&pwd=<my_cam_password>"
name: "Kitchen Camera Motion Cam"
value_template: >
{% set status = value | regex_findall_index('Alarm>(\d+)</motion') %}
{% set values = {'0':'Disabled', '1':'None', '2':'Detected'} %}
{{ values[status] if status in values.keys() else 'Not Determined'}}
scan_interval: 5
you can also get the motion detection status using the above for a switch you can use in the frontend to turn on or off the motion detection I use this for another camera that had a bad habit of turning it’s motion detection off periodically:
switch:
- platform: command_line
switches:
foscam_computer_cam_motion:
friendly_name: 'Computer Cam Motion'
command_on: 'curl -k "http://192.168.1.53:8003/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=1&schedule0=281474976710655&schedule1=281474976710655&schedule2=281474976710655&schedule3=281474976710655&schedule4=281474976710655&schedule5=281474976710655&schedule6=281474976710655&usr=<my_cam_user>&pwd=<my_cam_password>"'
command_off: 'curl -k "http://192.168.1.53:8003/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=0&usr=<my_cam_user>&pwd=<my_cam_password>"'
command_state: 'curl -k --silent "http://192.168.1.53:8003/cgi-bin/CGIProxy.fcgi?cmd=getMotionDetectConfig&usr=<my_cam_user>&pwd=<my_cam_password>" '
value_template: >
{% if value | regex_findall(find='isEnable>(\d+)</isEnable') != [] %}
{{ value | regex_findall_index('isEnable>(\d+)</isEnable') == '1'}}
{% else %}
{{ states('switch.foscam_computer_cam_motion') }}
{% endif %}