Author Topic: openLuup: Cameras  (Read 1474 times)

Offline bwillette

  • Sr. Newbie
  • *
  • Posts: 39
  • Karma: +2/-0
Re: openLuup: Cameras
« Reply #30 on: April 10, 2018, 05:56:56 pm »
Assuming AltUI uses one of these requests for rendering a cameras control panel pages (all I can tell currently is that your wget function gets called with the IP/URL pattern eventually), and/or this is what?s used when I trigger a request to capture a snapshot, we should be good!  Thanks again.

Online akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 5812
  • Karma: +249/-69
  • "Less is more"
Re: openLuup: Cameras
« Reply #31 on: April 11, 2018, 02:11:05 am »
Assuming AltUI uses one of these requests for rendering a cameras control panel pages (all I can tell currently is that your wget function gets called with the IP/URL pattern eventually),

As mentioned in the earlier thread, AltUI uses the DirectStreamingURL for direct access to camera video, when available.  However, if you know that wget is called for your setup, then this should do it.

Quote
and/or this is what?s used when I trigger a request to capture a snapshot, we should be good!  Thanks again.

AFAIK, that's the only way to get a snapshot.  I'll try and release this later today.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 4x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Online akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 5812
  • Karma: +249/-69
  • "Less is more"
Re: openLuup: Cameras
« Reply #32 on: April 11, 2018, 01:25:07 pm »
This change now in development release v18.4.10.

Indeed, with no VideoStreamingURL, AltUI uses /data_request?id=request_image&cam=xxx to try and generate an image stream.  This seems to have something of a detrimental effect on my browser, introducing some sort of (large) delay to the displayed image.  This only happens when on the device's control page.  A thumbnail is not presented on the Devices page.

However, both request_image and archive_video&format=1 (for a JPEG snapshot) work, with the image being written to the cmh-ludl/images/ folder.

With username and password as defined device attributes, the URL is suitably modified for these calls.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 4x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline bwillette

  • Sr. Newbie
  • *
  • Posts: 39
  • Karma: +2/-0
Re: openLuup: Cameras
« Reply #33 on: April 15, 2018, 09:59:07 pm »
Works like a champ Ak!  I can now see my camera snapshots on the control panel and they update just like UI7 does.  Thanks a bunch!

Online akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 5812
  • Karma: +249/-69
  • "Less is more"
Re: openLuup: Cameras
« Reply #34 on: April 16, 2018, 03:06:21 am »
Good to know! Thanks again for asking in the first place.  This was something that I've wanted to get right for quite a time.
« Last Edit: April 16, 2018, 03:34:07 am by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 4x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline jswim788

  • Hero Member
  • *****
  • Posts: 687
  • Karma: +44/-2
Re: openLuup: Cameras
« Reply #35 on: April 25, 2018, 12:13:55 pm »
Would it be possible for the request_image to have the luup.inet.wget replaced by code that will switch to digest authentication if it gets the 401/www-authenticate response?  Essentially, this code: https://github.com/catwell/lua-http-digest/blob/master/http-digest.lua  I believe UI7 supports this for the same request (http://forum.micasaverde.com/index.php/topic,38406.msg326659.html#msg326659).

Thanks
« Last Edit: April 25, 2018, 12:27:38 pm by jswim788 »

Online akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 5812
  • Karma: +249/-69
  • "Less is more"
Re: openLuup: Cameras
« Reply #36 on: April 25, 2018, 12:21:54 pm »
I'll take a look!
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 4x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Online akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 5812
  • Karma: +249/-69
  • "Less is more"
Re: openLuup: Cameras
« Reply #37 on: April 26, 2018, 09:39:20 am »
I was already thinking of including the MD5 hash algorithm for authentication in the POP3 server which is now part of openLuup. 

If I can get the digest authentication coded correctly, then I think that the easiest thing would simply be to have an additional parameter to request_image which specifies which authentication to use, rather than trying one and then another.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 4x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline jswim788

  • Hero Member
  • *****
  • Posts: 687
  • Karma: +44/-2
Re: openLuup: Cameras
« Reply #38 on: April 26, 2018, 11:24:42 am »
That sounds more efficient.  But how does the user get the parameter into the request_image when AltUI is making the request?  It would need to be in the camera device URL variable or some other variable that the GUI already accesses and passes on to the request_image?  (As you can see I'm not very familiar with how the GUI's such as AltUI do their work here.)  Or is the idea to make this AltUI specific where it knows to look at an additional variable?

Online akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 5812
  • Karma: +249/-69
  • "Less is more"
Re: openLuup: Cameras
« Reply #39 on: April 26, 2018, 11:42:41 am »
Good question, and there's lots of ways.

At the moment, there is a global openLuup system attribute "openLuup.Server.WgetAuthorization", which is, by default, set to "URL".  It may be set to "Header" to allow the use of headers instead.  It would be an easy matter to extend the options to Digest on a request-by-request basis.  But I'll play with it and see.

I've just been reviewing MD5 Lua modules, and my iMac has the "md5" one, which is also available to install under Debian systems (RPi, etc.)

Code: [Select]
apt-get install lua-md5

so we're halfway there.

My main impediment in testing, ATM, is the lack of hardware which needs this.  An alternative is an appropriate website.  Any suggestions* for what I could try?

______________________

Edit:  * it looks as though this might do the trick: https://docs.postman-echo.com/
« Last Edit: April 26, 2018, 11:52:38 am by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 4x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline jswim788

  • Hero Member
  • *****
  • Posts: 687
  • Karma: +44/-2
Re: openLuup: Cameras
« Reply #40 on: April 27, 2018, 12:38:32 am »
My main impediment in testing, ATM, is the lack of hardware which needs this.  An alternative is an appropriate website.  Any suggestions* for what I could try?
I can provide access if you would like to try this with a real camera.  Or I can be an alpha tester for you...

Online akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 5812
  • Karma: +249/-69
  • "Less is more"
Re: openLuup: Cameras
« Reply #41 on: April 27, 2018, 01:21:34 am »
I can provide access if you would like to try this with a real camera.  Or I can be an alpha tester for you...

That's splendid!  I'll get things working on postman-echo.com first, then we can give it a whirl.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 4x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Online rafale77

  • Hero Member
  • *****
  • Posts: 1006
  • Karma: +47/-20
    • My Setup
Sending Http Get difference
« Reply #42 on: May 03, 2018, 11:47:54 pm »
I am trying to move an amcrest camera from the vera to Openluup and have gotten to make it show livestream on ALTUI. However, I am unable to control it's PTZ, not even the presets. I have run some test and found that somehow running
luup.inet.wget ("http://camera.ip/cgi-bin/ptz.cgi?action=start&channel=0&code=GotoPreset&arg1=0&arg2=2&arg3=0",5, username, password) on the vera works while it doesn't on openluup.
Is there a difference in how the luup.inet.wget function is handled? are the timeout and credentials handled?
Openluup (93 devices, 88 scenes, 20 apps) controlling HomeAss + VeraPlus (132 zwave nodes, 8 Zigbee nodes, 202 devices, 71 scenes , 3 apps) +  Bridged to Homekit and Alexa

Offline jswim788

  • Hero Member
  • *****
  • Posts: 687
  • Karma: +44/-2
Re: Sending Http Get difference
« Reply #43 on: May 04, 2018, 01:08:58 am »
Most of the Amcrest cameras require digest authentication.  This was just discussed over here: http://forum.micasaverde.com/index.php/topic,63465.msg380840.html#msg380840  Vera seems to know how to try digest authentication if the basic authentication fails.

I'm not 100% sure how you can get the live stream to work, but maybe that uses something else to authorize (or doesn't need it).  Or my theory above is wrong.

Online akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 5812
  • Karma: +249/-69
  • "Less is more"
Re: openLuup: Cameras
« Reply #44 on: May 04, 2018, 01:26:55 am »
I've just merged the previous two posts from a separate new thread into this topic.

Yes @rafale77, as @jswim788 has mentioned, this is the discussion to watch.

Yes both, I am being tardy in implementing this, although I see no real technical problem in doing so.  I've made some steps forward with cameras recently, and it's important to me to try and get this aspect of openLuup as functional as possible.  The SMTP server and email camera triggers were part of that.  That then prompted a POP3 server for more general email use, and an implementation of file retention policies to contain the burgeoning image files.  There are going to be some limits as to what is possible, in particular video streams, for which I mostly rely on AltUI.

There are reasons for my slowness here, not least the other demands you have placed on me recently (but other more significant ones too!)   I just need a bit of time to sort myself out.

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