openLuup: Video, Cameras, ...

Questions relating to video images and related devices…

[quote=“mda, post:393, topic:187412”]…were you able to get the request_image call that HomeWave uses implemented perchance so i can setup native camera devices in openluup that Homewave can use instead of Homewave getting the cameras from Vera (which causes vera to reload luup in my system for some strange reason MCV tech support has not been able to figure out in over a year :wink: ?

If so, then i will start with the cameras then move on to GCal3, DLNA Media Controller, iPhone Locator, Weather, etc. plug ins (hopefully this weekend).[/quote]

Here’s something to try. A new openLuup/requests.lua which implements the HTTP request_image call documented here: http://wiki.micasaverde.com/index.php/Luup_Requests#request_image

http://VeraIP:3480/data_request?id=request_image&cam=5

…at the moment [tt]&cam=deviceID[/tt] is the only implemented parameter. It also assumes a JPEG return type. The above request works in a browser, but I haven’t tried it in HomeWave… thought I’d leave that pleasure to you!

Has anyone tried to implement the Blue Iris plugin locally OR attempted to add their camera feed ? If not, then I may give this a try soon. I’ve never been successful in getting Vera to add my cameras (Hikvision, Dahau PTZ).

I’ve started Blue Iris up, but without a camera of my own it’s hard to tell.

I’ll give it a go and report back as I’m very curious as to the load it creates on the system (hardware).

@akbooer the camera I PMd you is actually coming from blue iris 3.x

OK, quick test before I crash out for the evening…
My camera server is a dedicated node running the latest Blue Iris. I have 7 cameras (1080p). For this test, I’ll use my front entry door feed.

openLuup code is dated October 23/24 [Release 5.3 w/hot fix].

Within ‘Lua Test Code’ - I pasted in the following (provided earlier by Akbooer):

do -- Blue Iris Camera
  local dev = luup.create_device ('', "DigitalSecurityCamera1", "DigitalSecurityCamera1", "D_DigitalSecurityCamera1.xml")  
  local sid = "urn:micasaverde-com:serviceId:Camera1"
  luup.variable_set (sid, "Timeout", "5", dev)
  luup.variable_set (sid, "URL", "http://platinum:81/image/front", dev)
  luup.variable_set (sid, "DirectStreamingURL", "http://platinum:81/image/front", dev)
end

And log data:

2015-10-27 23:38:29.789   openLuup.server:: /data_request?id=lr_ALTUI_LuaRunHandler&command=run_lua&lua=do%20--%20Camera%0A%20%20local%20dev%20%3D%20luup.create_device%20(%27%27%2C%20%22DigitalSecurityCamera1%22%2C%20%22DigitalSecurityCamera1%22%2C%20%22D_DigitalSecurityCamera1.xml%22)%20%20%0A%20%20local%20sid%20%3D%20%22urn%3Amicasaverde-com%3AserviceId%3ACamera1%22%0A%20%20luup.variable_set%20(sid%2C%20%22Timeout%22%2C%20%225%22%2C%20dev)%0A%20%20luup.variable_set%20(sid%2C%20%22URL%22%2C%20%22http%3A%2F%2Fplatinum%3A81%2Fimage%2Ffront%22%2C%20dev)%0A%20%20luup.variable_set%20(sid%2C%20%22DirectStreamingURL%22%2C%20%22http%3A%2F%2Fplatinum%3A81%2Fimage%2Ffront%22%2C%20dev)%0Aend&_=1446006941814 tcp{client}: 0x2653fb8
2015-10-27 23:38:29.790   luup_log:0: ALTUI: runLua(do -- Camera
  local dev = luup.create_device ('', "DigitalSecurityCamera1", "DigitalSecurityCamera1", "D_DigitalSecurityCamera1.xml")  
  local sid = "urn:micasaverde-com:serviceId:Camera1"
  luup.variable_set (sid, "Timeout", "5", dev)
  luup.variable_set (sid, "URL", "platinum:81/image/front", dev)
  luup.variable_set (sid, "DirectStreamingURL", "platinum:81/image/front", dev)
end)
2015-10-27 23:38:29.827   luup.create_device:0: [135] urn:schemas-upnp-org:device:DigitalSecurityCamera:1 / no-implementation-file
2015-10-27 23:38:29.827   luup.variable_set:0: 135.urn:micasaverde-com:serviceId:Camera1.Timeout was: EMPTY now: 5 #hooks:0
2015-10-27 23:38:29.827   luup.variable_set:0: 135.urn:micasaverde-com:serviceId:Camera1.URL was: EMPTY now: http://platinum:81/image/front #hooks:0
2015-10-27 23:38:29.827   luup.variable_set:0: 135.urn:micasaverde-com:serviceId:Camera1.DirectStreamingURL was: EMPTY now: http://platinum:81/image/front #hooks:0

I then executed ‘Reload Luup Engine’. I have a Camera device which shows a very small image on the front. I don’t have any idea at the moment how to obtain the streaming URL so the image will have to suffice for now (the image does not refresh). I can see why this would place a decent load on the system, looking at the debug for my Blue Iris feed - I’m guessing maybe 1 meg per second/per image.

A direct feed method provided by HomeWave (which of course I use) would be a better option, something I believe has been asked in the past.

Hmm…, not quite the experience that I had. @mda kindly provided a feed, which shows the thumbnail updated every second or so on the Devices page of ALTUI (next to the camera icon.) Clicking on the icon takes you to the control panel with a much larger image updated in real time.

Not having a camera, I didn’t know what more to expect, but this seems like a fair start.

My preferred setup code now sets the IP address of the device (maybe the port should go there too??) and leaves out the “http://” in the URLs. This works:

do -- Camera
  local dev = luup.create_device ('', "Camera", "Camera", "D_DigitalSecurityCamera1.xml")  
  local sid = "urn:micasaverde-com:serviceId:Camera1"
  luup.ip_set ("123.456.789.012", dev)
  luup.variable_set (sid, "Timeout", "5", dev)
  luup.variable_set (sid, "URL", ":1234/image/mycam", dev)
  luup.variable_set (sid, "DirectStreamingURL", ":1234/mjpg/mycam/video.mjpg", dev)
end

…but I don’t know what is best practice.

Note that I am using the patch I posted (aimed towards @mda) here: http://forum.micasaverde.com/index.php/topic,34472.msg253886.html#msg253886

Whilst I aim to keep GitHub up to date, I have not yet generated a development branch or other branches, so a simple patch posted seemed the best way to do it at the time.

[Edit: I have now updated GitHub ]

I now have video by using this (thanks for info)…

luup.variable_set (sid, "DirectStreamingURL", ":1234/mjpg/mycam/video.mjpg", dev)

I’ll have to defer until tonight to load the patch as I definitely want to test this in HomeWave…

Here's something to try. A new openLuup/requests.lua which implements the HTTP request_image call documented here:
Hmm..., not quite the experience that I had. @mda kindly provided a feed, which shows the thumbnail updated every second or so on the Devices page of ALTUI (next to the camera icon.) Clicking on the icon takes you to the control panel with a much larger image updated in real time.

Not having a camera, I didn’t know what more to expect, but this seems like a fair start.

My preferred setup code now sets the IP address of the device (maybe the port should go there too??) and leaves out the “http://” in the URLs. This works:

do -- Camera
  local dev = luup.create_device ('', "Camera", "Camera", "D_DigitalSecurityCamera1.xml")  
  local sid = "urn:micasaverde-com:serviceId:Camera1"
  luup.ip_set ("123.456.789.012", dev)
  luup.variable_set (sid, "Timeout", "5", dev)
  luup.variable_set (sid, "URL", ":1234/image/mycam", dev)
  luup.variable_set (sid, "DirectStreamingURL", ":1234/mjpg/mycam/video.mjpg", dev)
end

…but I don’t know what is best practice.

Note that I am using the patch I posted (aimed towards @mda) here: http://forum.micasaverde.com/index.php/topic,34472.msg253886.html#msg253886

Whilst I aim to keep GitHub up to date, I have not yet generated a development branch or other branches, so a simple patch posted seemed the best way to do it at the time.

[Edit: I have now updated GitHub ]

OK, this works in HomeWave.

The correct syntax is IP:PORT for the IP address attribute and then /… for the URLs. Something like this:

do -- Camera
  local dev = luup.create_device ('', "Camera", "Camera", "D_DigitalSecurityCamera1.xml")
  local sid = "urn:micasaverde-com:serviceId:Camera1"
  luup.ip_set ("a.b.c.d:port", dev)
  luup.variable_set (sid, "Timeout", "5", dev)
  luup.variable_set (sid, "URL", "/image/mycam", dev)
  luup.variable_set (sid, "DirectStreamingURL", "/mjpg/mycam/video.mjpg", dev)
end

I’m using the latest from GitHub.

NICE !

[quote=“akbooer, post:10, topic:189401”]OK, this works in HomeWave.

The correct syntax is IP:PORT for the IP address attribute and then /… for the URLs. Something like this:

do -- Camera
  local dev = luup.create_device ('', "Camera", "Camera", "D_DigitalSecurityCamera1.xml")
  local sid = "urn:micasaverde-com:serviceId:Camera1"
  luup.ip_set ("a.b.c.d:port", dev)
  luup.variable_set (sid, "Timeout", "5", dev)
  luup.variable_set (sid, "URL", "/image/mycam", dev)
  luup.variable_set (sid, "DirectStreamingURL", "/mjpg/mycam/video.mjpg", dev)
end

I’m using the latest from GitHub.[/quote]

[quote=“akbooer, post:10, topic:189401”]OK, this works in HomeWave.

The correct syntax is IP:PORT for the IP address attribute and then /… for the URLs. Something like this:

do -- Camera
  local dev = luup.create_device ('', "Camera", "Camera", "D_DigitalSecurityCamera1.xml")
  local sid = "urn:micasaverde-com:serviceId:Camera1"
  luup.ip_set ("a.b.c.d:port", dev)
  luup.variable_set (sid, "Timeout", "5", dev)
  luup.variable_set (sid, "URL", "/image/mycam", dev)
  luup.variable_set (sid, "DirectStreamingURL", "/mjpg/mycam/video.mjpg", dev)
end

I’m using the latest from GitHub.[/quote]

Confirmed! Works on Homewasve for me to (with openluup running on a Mac). Thank you @akbooer !!!

Thanks you for the camera feeed (nice crustacean!)

Thanks you for the camera feeed (nice crustacean!)[/quote]

:slight_smile: Thanks.

I will take it down now… just let me know if you need it again anytime. Thanks.

I probably need to buy my own (camera, not crustacean) :wink:

My kid likes the crustacean more than the camera, fwiw :wink:

Could the following situation be a little bug?

I’ve created a camera entry on the startup.lua file. the camera gets created just fine and openluup is only able to retrieve the first image from the camera, after that openluup returns an error.

While I was digging I noticed the url that is being used to retrieve the image is incorrect as it add “%27” next to the device id.

data_request?id=request_image&cam=6%27&t=1457932407551

If %27 is removed openluup is able to retrieve the image. I tried to find how that value (%27) could be getting there but no luck.

I need to see

[ol][li]the startup.lua extract showing the luup.create_device[/li]
[li]the log extract showing the error[/li]
[li]the extract of user_data.json showing the device definition.[/li][/ol]

Where did you see and correct the URL?
%27 is, of course, a URL-encoded single quote. I wonder where it comes from?


do -- Camera
  local dev = luup.create_device ('', "Foscam", "Foscam", "D_DigitalSecurityCamera1.xml")
  local sid = "urn:micasaverde-com:serviceId:Camera1"
  luup.ip_set ("10.10.10.237:88", dev)
  luup.variable_set (sid, "Timeout", "5", dev)
  luup.variable_set (sid, "username", "user", dev)
  luup.variable_set (sid, "password", "pass", dev)
  luup.variable_set (sid, "URL", "/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=user&pwd=pass", dev)
end
2016-03-14 10:24:18.942   openLuup.server:: new client connection: tcp{client}: 0x1c04858
2016-03-14 10:24:18.943   openLuup.server:: new client connection: tcp{client}: 0x13722f8
2016-03-14 10:24:18.943   openLuup.server:: new client connection: tcp{client}: 0x20428f8
2016-03-14 10:24:18.944   openLuup.server:: new client connection: tcp{client}: 0x14a0f88
2016-03-14 10:24:19.045   openLuup.server:: /data_request?id=request_image&cam=6%27&t=1457932463336 tcp{client}: 0x19da2b8
2016-03-14 10:24:19.054   openLuup.server:: request completed (5 bytes, 1 chunks, 8 ms) tcp{client}: 0x19da2b8
2016-03-14 10:24:19.253   openLuup.server:: /favicon.ico tcp{client}: 0x19da2b8
2016-03-14 10:24:19.260   openLuup.HTTP.FILE:: file not found:favicon.ico
2016-03-14 10:24:19.261   openLuup.server:: request completed (0 bytes, 0 chunks, 7 ms) tcp{client}: 0x19da2b8
2016-03-14 10:24:19.590   openLuup.server:: /data_request?id=request_image&cam=6%27&t=1457932463336 tcp{client}: 0x19da2b8
2016-03-14 10:24:19.598   openLuup.server:: request completed (5 bytes, 1 chunks, 7 ms) tcp{client}: 0x19da2b8
2016-03-14 10:24:19.758   openLuup.server:: /favicon.ico tcp{client}: 0x19da2b8
2016-03-14 10:24:19.765   openLuup.HTTP.FILE:: file not found:favicon.ico
2016-03-14 10:24:19.765   openLuup.server:: request completed (0 bytes, 0 chunks, 6 ms) tcp{client}: 0x19da2b8
2016-03-14 10:24:19.958   openLuup.server:: /data_request?id=request_image&cam=6%27&t=1457932463336 tcp{client}: 0x19da2b8
2016-03-14 10:24:19.965   openLuup.server:: request completed (5 bytes, 1 chunks, 6 ms) tcp{client}: 0x19da2b8
2016-03-14 10:24:20.066   openLuup.server:: /favicon.ico tcp{client}: 0x19da2b8
2016-03-14 10:24:20.073   openLuup.HTTP.FILE:: file not found:favicon.ico
2016-03-14 10:24:20.073   openLuup.server:: request completed (0 bytes, 0 chunks, 6 ms) tcp{client}: 0x19da2b8

    "altid":"Foscam",
    "category_num":6,
    "device_file":"D_DigitalSecurityCamera1.xml",
    "device_json":"D_DigitalSecurityCamera1.json",
    "device_type":"urn:schemas-upnp-org:device:DigitalSecurityCamera:1",
    "disabled":0,
    "id":6,
    "id_parent":0,
    "invisible":"0",
    "ip":"10.10.10.237:88",
    "mac":"",
    "manufacturer":"",
    "model":"",
    "name":"Foscam",
    "room":"0",
    "states":[{
      "id":45,
      "service":"urn:micasaverde-com:serviceId:Camera1",
      "value":"user",
      "variable":"pass"
    },{
      "id":46,
      "service":"urn:micasaverde-com:serviceId:Camera1",
      "value":"5",
      "variable":"Timeout"
    },{
      "id":47,
      "service":"urn:micasaverde-com:serviceId:Camera1",
      "value":"\/cgi-bin\/CGIProxy.fcgi?cmd=snapPicture2&usr=user&pwd=pass",
      "variable":"URL"
    },{
      "id":48,
      "service":"urn:micasaverde-com:serviceId:Camera1",
      "value":"\/cgi-bin\/CGIStream.cgi?cmd=GetMJStream&usr=user&pwd=pass",
      "variable":"DirectStreamingURL"
    },{
      "id":49,
      "service":"urn:micasaverde-com:serviceId:Camera1",
      "value":"admin",
      "variable":"username"
    }],
    "subcategory_num":0,
    "time_created":1457935099
  }

the %27 is for a single quote character. could it be possible that there is a extra character somewhere flying around?

…but where is the request coming from? I assume this is from AltUI, if you are on the device page which contains the camera.

You are saying that if you issue the correct action request manually, then you retrieve the image OK?

I don’t have a camera, so I can’t easily test this, although I could mock something up if necessary.