IP camera motion detector

I finally was able to get a binary sensor created to reflect in-camera motion detection of my FDT camera. FDT cameras are very similar to Foscam, but they don’t have a corresponding cgi command that I could use to trigger automations in Home Assistant (at least that I could find). Here are the steps in case anyone else could use them. Basically, the binary sensor is “on” when motion was detected within the past 60 seconds.

  1. Temporarily install the “FDT View” app on your phone.
  2. Connect to the camera on the app and under settings -> alert, select push notifications.
  3. Add this to configuration.yaml changing CAMERAIP to your ip address:
sensor:
  - platform: command_line
    name: fdt motion raw
    command: "curl -s -k http://CAMERAIP/web/tmpfs/push_record.log | tail -1 | cut -c3-"
    value_template: "{{ as_timestamp(now()) | float - value | float }}"
binary_sensor:
  - platform: template
    sensors:
      fdt_motion:
        friendly_name: "FDT Motion"
        value_template: >-
           {{ states('sensor.fdt_motion_raw') | float < 60 }}
  1. Remove app from phone

Also, my motion trigger was too sensitive, and I couldn’t properly set the sensitivity from the webpage configuration so I used the following command. Play with the “s=xx” option to find the right sensitivity for you (0-100):

curl -k "http://CAMERAIP/cgi-bin/hi3510/param.cgi?cmd=setmdattr&-enable=1&-s=10&-name=1&-x=0&-y=0&-w=1920&-h=1080&-usr=admin&-pwd=xxxxxxxx"