Amcrest Sensor Scan Interval

I was trying to troubleshoot my issue with my Amcrest Cameras today, again, and came up with an error I have not seen before but that is due to the fact I decided to add the Amcrest IP Camera Sensor so I could pick up the motion detection and SD card usage. Anyway, I was using that as part of the troubleshooting just to see if I could get the crazy stuff to show up and saw the following error:

17-03-18 02:11:31 ERROR (MainThread) [homeassistant.bootstrap] Invalid config for [sensor.amcrest]: expected int for dictionary value @ data['scan_interval']. Got datetime.timedelta(0, 10). (See ?, line ?). Please check the docs at

Now, the documentation says the default scan interval is 10 seconds but I have always been taught with respect to writing code or configurations for that matter, to set things explicitly rather than relying on the defaults where possible. So I added the scan_interval setting and set it to the default.

It ‘appears’ to be pointing to the integer value, so I assume it does not like the default value being explicitly set? Or is there something else going on.

Anyone seen this issue before or know what is going on?

It looks like there’s a bug in the code.

The system keeps formatting the input 10, “10”, ‘10’, etc. as a datetime format.

I had to explicitly specify the type as integer for it to work.
Someone should submit a bug report, but I don’t have time right now.

See my config (and binary_sensor template to convert this sensor to true binary!)

  - platform: amcrest
    host: !secret cam_ip
    username: !secret cam_user
    password: !secret cam_pass
    scan_interval: !!int 10
      - motion_detector

  - platform: template
        value_template: "{{ states('sensor.amcrest_motion_detected') == True }}"
        friendly_name: "Living Room Motion"
        device_class: motion
        entity_id: sensor.amcrest_motion_detected
1 Like


I’m looking into this issue.

@mike1237 thanks for much for reporting this problem.

The issue was when passing the scan_interval it was not being recognized as timedelta value. It was a bug in the code.

The PR#6685 - fixes the issue.

Please let me know if that works for you.