Foscam ip intergration

I have same issue as well, get “image not available” in GUI
I can tell this happens after I update firmware

Debug log shown:
2019-06-26 18:15:54 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.2759530000] Sending {‘id’: 16, ‘success’: False, ‘error’: {‘message’: ‘Unable to fetch image’, ‘code’: ‘image_fetch_failed’}, ‘type’: ‘result’}
2019-06-26 18:15:54 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.2759530000] Sending {‘id’: 15, ‘success’: False, ‘error’: {‘message’: ‘Unable to fetch image’, ‘code’: ‘image_fetch_failed’}, ‘type’: ‘result’}

I have FI9900P in my system works, this is my configuration

 - platform: foscam
    name: Resede
    ip: 192.168.1.xxx
    username: !secret foscam_user
    password: !secret foscam_pswd
    port: 88

Hello,
Is that a way to have a moving detection as a home assistant sensor ?

Is that a part of Foscam integration ?

Best regards
Thierry

No the Foscam integration only provides the camera stream.

You have to create a motion sensor yourself with a command-line sensor.

Here are two examples using two different cgi command formats. Use the one that matches your camera.

sensor:
  - platform: command_line
    name: "Kitchen Camera Motion"
    command: curl -k --silent "http://192.168.1.51:8001/get_status.cgi?user=your_username&pwd=your_pwd"
    value_template: >-
      {% set status = value | regex_findall_index('alarm_status=(\d+);') %}
      {%- if status == "0" -%}
        None
      {%- elif status == "1" -%}
        Detected
      {% else %}
         Not Determined
      {%- endif -%}
    scan_interval: 3 
  
  - platform: command_line  
    command: curl -k --silent "http://192.168.1.52:8002/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=your_user&pwd=your_pwd"
    name: "Garage Camera Motion"
    value_template: >
      {% set status = value | regex_findall_index('Alarm>(\d+)</motion') %}
      {% if status == "0" %}
        Disabled
      {%- elif status == "1" -%}
        None
      {%- elif status == "2" -%}
        Detected
      {% else %}
        Not Determined
      {%- endif -%}
    scan_interval: 3
3 Likes

I have a Foscam FI8918W and cannot get it to work with HA. My code is very similar to marcoparco above but it’s not working for me. Any ideas?

I have the ip, port and username/PW correct. It shows up as “idle” with a broken frame on the dashboard. Also says it does not have a unique ID (not sure if that is why it’s not working or not)

I used mjpeg url to get mine working😉

# Setup Mjpeg video stream for Foscam
camera:
  - platform: mjpeg
    name: "babycam" 
    mjpeg_url: !secret foscam_video_url

where secret is like
foscam_video_url: “http://192.168.1.11/videostream.cgi?user=foscamusr&pwd=545664

Thanks! That is similar to what got me going! Now to add PTZ controls…fingers crossed :slight_smile:

# Motion detection 
  - platform: command_line
    name: "Motion"
    command: !secret foscam_status_url
    value_template: >-
      {% set status = value | regex_findall_index('alarm_status=(\d+);') %}
      {%- if status == "0" -%}
        None
      {%- elif status == "1" -%}
        Detected
      {% else %}
        Not Determined
      {%- endif -%}
    scan_interval: 3

where
foscam_status_url: curl -k --silent “http://192.168.1.11/get_status.cgi?user=foscamusr&pwd=528352773

oh…PTZ is not patrol zone is it?
if you ment getting the camera to move…never managed to do that :yum:

I tried though…
image

Yea I’d like to get those arrows to work :slight_smile:

if you figured it out, let me know!
:wink: