Author Topic: Limit camera refresh rate in emulation mode  (Read 236 times)

Offline egoh

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
Limit camera refresh rate in emulation mode
« on: June 07, 2018, 10:29:40 am »
Hi folk,

I have a bunch of Q-See (Dahua) cameras that are hooked to my Vera Plus.

Is there any way to limit the refresh rate on a D_DigitalSecurityCamera2.xml device?

I'm running these cameras in emulation mode so Vera is grabing JPEGs at a pretty high rate. A few of the cameras I have have some sort of flood control security and block the Vera after viewing the camera few a little while from Vera. I then have to power cycle the affected camera. If I can slow the rate at which Vera polls the device, I think I can resolve my issue. Any ideas?

Thanks!

Offline akbooer

  • Master Member
  • *******
  • Posts: 5873
  • Karma: +251/-69
  • "Less is more"
Re: Limit camera refresh rate in emulation mode
« Reply #1 on: June 07, 2018, 11:58:14 am »
That's a really good question.

I ran into a similar problem, but didn't, alas, come up with a simple solution.  The only idea I have to offer is to make a dummy device of the same variety and implement the request_image action with a built-in delay using luup.call_delay()

Not trivial to do, but not too difficult, perhaps.  However, if you're not a developer, this won't help.  Sorry!
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline egoh

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
Re: Limit camera refresh rate in emulation mode
« Reply #2 on: June 07, 2018, 02:05:44 pm »
akbooer, Thanks! You're always incredibly helpful! I'm new to Lua but can code. I'll take a look and see if it's worth my time.

Offline akbooer

  • Master Member
  • *******
  • Posts: 5873
  • Karma: +251/-69
  • "Less is more"
Re: Limit camera refresh rate in emulation mode
« Reply #3 on: June 07, 2018, 02:37:04 pm »
You're welcome, although nothing has actually been achieved yet!

On further thoughts, just a new implementation file for the device in question would probably do it.

You'd have to duplicate any of the actions which you use.  Is it steerable?  Or is it just fixed, and all you need is the images?

An existing example would be the Foscam implementation, which is floating around somewhere.

3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline egoh

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
Re: Limit camera refresh rate in emulation mode
« Reply #4 on: June 07, 2018, 03:57:19 pm »
I was referring to your help many years ago with the Netatmo plugin :) Correct, it's fixed and all I need are the images.

Offline akbooer

  • Master Member
  • *******
  • Posts: 5873
  • Karma: +251/-69
  • "Less is more"
Re: Limit camera refresh rate in emulation mode
« Reply #5 on: June 07, 2018, 04:09:02 pm »
I was referring to your help many years ago with the Netatmo plugin :)

Oooh, four years ago, already!

Quote
Correct, it's fixed and all I need are the images.

That simplifies things, but the trick will be in delaying the response without blocking other device actions.  What would you regard as a useful delay between image updates?  Actually, what do you get at the moment, with no delay?
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline egoh

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
Re: Limit camera refresh rate in emulation mode
« Reply #6 on: June 07, 2018, 04:24:51 pm »
Right now it seems to do about 3-4 FPS which is a bit too much for a few cameras. I was thinking 1 frame every 3 seconds. Should be enough for getting an idea what's going on and I can always switch to a dedicated app for non-emulated video.

Offline akbooer

  • Master Member
  • *******
  • Posts: 5873
  • Karma: +251/-69
  • "Less is more"
Re: Limit camera refresh rate in emulation mode
« Reply #7 on: June 07, 2018, 04:46:53 pm »
Do you have another machine/server available other than Vera?

The problem is that if we involve Vera in the process, then we slow EVERYTHING down (and possibly make it restart more often) simply because we would route every image data snapshot through the machine.   At the moment, request_image directly uses the camera URL for snapshots, and Vera isn't in the loop at all.

If you were using AltUI, or openLuup, then there would be other options:
  • AltUI - we could try and request @amg0 to introduce an optional delay configuration parameter
  • openLuup - already implements the &MinimumDelay=... parameter for  ALL /data_request&id=... calls

It can still be done another way:  if you do have a separate machine, you could set up a CGI, say, as a proxy for the camera URL, but with the side-effect that it adds a delay in responding.

Once again, a lot more effort than should be necessary to get around a minor Vera omission.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline egoh

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
Re: Limit camera refresh rate in emulation mode
« Reply #8 on: June 08, 2018, 09:29:32 am »
Thanks for your insight!

Yes, I have a couple servers running all the time. I think I should rethink my configuration. Might be easier to switch my camera recording to one of my servers (vs an NVR) and serve images/video from that server, which would give me better control over how things are handled and would insulate the tiny linux instances in each camera from getting hammered with traffic.

Offline akbooer

  • Master Member
  • *******
  • Posts: 5873
  • Karma: +251/-69
  • "Less is more"
Re: Limit camera refresh rate in emulation mode
« Reply #9 on: June 08, 2018, 10:59:49 am »
Yes, I have a couple servers running all the time. I think I should rethink my configuration. Might be easier to switch my camera recording to one of my servers (vs an NVR) and serve images/video from that server, which would give me better control over how things are handled and would insulate the tiny linux instances in each camera from getting hammered with traffic.

Yes, exactly!
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.