Generic IP Camera and scan_interval

I have configured Dlib face detection/recognition in HA, and while that is working really good, I have a problem with the scan interval of my Generic IP Cameras. As far as I can tell, pictures from generic cameras are refreshed every 10 seconds, and face detection can only take place when a new picture is available. For face detection, this setting is too high - I can’t stand in front of my camera up to 10 seconds before my face is recognized (without looking a little stupid at least).

Under the Image Processing Component, the following is suggested:

For interval control, use scan_interval in platform.

I have tried this. My configuration is as follows:

camera:
  - platform: generic                                                                                                              
    still_image_url: http://192.168.x.xx:8080/stream/snapshot.jpg                                                                  
    name: Kitchen                                                                                                                  
    username: admin                                                                                                                
    password: !secret camera_password                                                                                              
    authentication: digest                                                                                                         
    scan_interval: 2                                                                                                               

This, however, does not work.

So my obvious question is: How can I change the scan_interval to a lower number for the cameras where I want to add face regognition? Is it at all possible?

1 Like

were you able to change the scan interval? if yes, can you share?
thanks

Hi,

Unfortunately I was not able to change the scan interval. I have tried lots of options, but as far as I can tell there is no workaround. This makes face recognition i HA pretty useless for me, and I have put the project on hold.

Apparently, when using the Android IP Webcam you can change the scan interval down to 1 second. This would be perfect, but it does not work for the generic camera component.

thanks for the Info.

Hi…

Could you provide me details how did you implement this successfully as a working model.

10 seconds delay is OK for my application.

Thanks.

Hi KvRajan,

Sure! Here is what I did:

camera:
  - platform: generic
    still_image_url: http://192.168.x.x:8080/stream/snapshot.jpg
    name: Kitchen
    username: admin
    password: !secret camera_password
    authentication: digest
    scan_interval: 2

Of course - the scan_interval is not working, but I left it there in case it suddenly would :wink:

image_processing:
  - platform: dlib_face_detect
    keep_faces: True
    keep_no_faces: True
    source:
      - entity_id: camera.kitchen

  - platform: dlib_face_identify
    keep_known_faces: True
    keep_unknown_faces: True
    source:
      - entity_id: camera.kitchen
        name: "Kitchen Face Recognition"
    faces:
      thomas: /var/opt/homeassistant/pics/thomas1.jpg
      paula: /var/opt/homeassistant/pics/paula1.jpg

The “dlib_face_detect” will just detect faces, and give you a number of faces it is currently detecting. Adding the second entry, “dlib_face_identify”, will also identify faces from pictures that you have stored locally on your HA server.

I think that’s just about it :slight_smile:

-Thomas

1 Like

Hi…

Thanks for sharing the config details.

I’m not at that level yet and hence need the steps needed to carry out from scratch for this to work - what all needs to be installed [pre-requisites] and how to test it at each phase to come to this stage successfully.

Thanks in advance.

This is a bit of an old thread, but new developers may find this useful: there is now a “framerate:” configuration variable. This allows to update an image down to once a second by setting it to 1.
Unfortunately, decimal values are not allowed. These could have allowed to lower the refresh down to once ever few seconds or even larger intervals…

1 Like

I was about to write a bug on this, but I’m not sure if that is correct… is this a bug, or should it be a feature request? Or are we all doing something incorrect?

camera:

  • platform: generic
    name: meteogram
    still_image_url: !secret meteogram_url
    content_type: ‘image/gif’
    scan_interval: 10800

The scan_interval is ignored and it pulls an image every 10 seconds. The site admin blocked me because it was hammering his site. And he was being very nice - in reality the token is tied to a credit card and there is a charge for every hit if the requests are too frequent (which makes me wonder if I want HA to be doing this anyway even if this works… a bug could reintroduce a problem in the future).

I assume that it would be possible to work around this by having a script running in the background that pulls the image and then have HA display the image from a file. Anyone ironed that approach out and would like to share?

Thanks!

My issue is still unresolved, but if I am not mistaken, the value “scan_interval” is removed from the documentation. I am guessing that this is now set to 10 seconds, and that you can not change it.

This would be a feature request I guess, as the component is working like the documentation says (although the image interval time is not mentioned there).

Someone already had a feature request for this… I’d encourage everyone to go vote for it:

Playing with TileBoard, I find that I can set the refresh both the camera thumbnail and the zoomed in (big) view. They both work. So It MUST be possible…
Two possibilities here:

  1. Use TileBoard
  2. TileBoard sits atop HA. So figure out how/what TB is doing. Going to drill down there.
    I am using camera platform mjpeg to control several DLINK DCS-5020Ls. I have been unable to affect the refresh in HA, have tried all the plausible things, etc.

Is there any followup here?
Sorry about necro’ing this thread, but I have my grafana graphs set up as generic cameras.
Each ha user screen displaying them causes the 10s 'ish call to grafana & therefore influxdb.
These (docker) containers then become unnecessary flooded & less responsive.

Sorry for an additional thread necro, but I have searched and am coming up empty.
I have added an ESP32-CAM as a generic IP camera. I added the still_image_url only.
In the dashboard, it seems to be refreshing every 10 seconds and if I click to zoom, it refreshes pretty much as fast as possible. I have modified the camera code to use the LED flash, so it is flickering away quite rapidly.
I would like this to:

  • Take an image only once on demand
  • Store and display the last image captured
  • Automate this to take a snapshot at a specified time once per day (or on a similar schedule)

These don’t seem to be unreasonable requirements, but I am not finding any relevant info. The scan_interval parameter seemed to change nothing. Thanks for any help.