We have moved at community.getvera.com

Author Topic: openLuup: Video, Cameras, ...  (Read 10578 times)

Offline mda

  • Sr. Member
  • ****
  • Posts: 464
  • Karma: +9/-0
Re: openLuup: Video, Cameras, ...
« Reply #15 on: October 29, 2015, 04:10:45 am »
I probably need to buy my own (camera, not crustacean)  ;)

My kid likes the crustacean more than the camera, fwiw ;)

Offline ronluna

  • Jr. Member
  • **
  • Posts: 96
  • Karma: +1/-3
Re: openLuup: Video, Cameras, ...
« Reply #16 on: March 14, 2016, 01:28:58 am »
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.

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup: Video, Cameras, ...
« Reply #17 on: March 14, 2016, 03:57:26 am »
I need to see
  • the startup.lua extract showing the luup.create_device
  • the log extract showing the error
  • the extract of user_data.json showing the device definition.
Where did you see and correct the URL?
%27 is, of course, a URL-encoded single quote.  I wonder where it comes from?
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 ronluna

  • Jr. Member
  • **
  • Posts: 96
  • Karma: +1/-3
Re: openLuup: Video, Cameras, ...
« Reply #18 on: March 14, 2016, 10:27:56 am »
Code: [Select]

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


Code: [Select]
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


Code: [Select]

    "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?
« Last Edit: March 14, 2016, 10:33:32 am by ronluna »

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup: Video, Cameras, ...
« Reply #19 on: March 14, 2016, 01:21:41 pm »
...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.
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 ronluna

  • Jr. Member
  • **
  • Posts: 96
  • Karma: +1/-3
Re: openLuup: Video, Cameras, ...
« Reply #20 on: March 14, 2016, 02:17:55 pm »
...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.

Your assumptions are precisely right. That is indeed coming from altui. and whe I looked at the source of altui that when I found out that the first request of the image comes with the right url format and all the other refreshed images come with the single quote symbol or "%27" next to the device id.

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup: Video, Cameras, ...
« Reply #21 on: March 14, 2016, 02:20:53 pm »
Sounds like it's time to ask @amg0 about this.  Can you try it on a real Vera or is that too hard?
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 ronluna

  • Jr. Member
  • **
  • Posts: 96
  • Karma: +1/-3
Re: openLuup: Video, Cameras, ...
« Reply #22 on: March 14, 2016, 03:49:19 pm »
Sounds like it's time to ask @amg0 about this.  Can you try it on a real Vera or is that too hard?

Loading the cameras on ALTUI directly from the Vera controller works as expected. It refreshes just fine.

But. On the real thing I can see single quote. next to the device id.

src="?id=request_image&cam=63'&t=1457984883805"

Perhaps openluup is escaping some characters?

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup: Video, Cameras, ...
« Reply #23 on: March 14, 2016, 06:58:26 pm »
src="?id=request_image&cam=63'&t=1457984883805"

Perhaps openluup is escaping some characters?

...well, that line is definitely wrong, even if Vera manages to deal with it.
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 delle

  • Full Member
  • ***
  • Posts: 134
  • Karma: +3/-0
Re: openLuup: Video, Cameras, ...
« Reply #24 on: April 18, 2016, 12:14:30 pm »
same problem for me;
openluup on vera shows image while openluup on raspberry no image at all.  It also seems the camera on the raspberry openluup shows less attributes(eg user, password are missing).

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup: Video, Cameras, ...
« Reply #25 on: April 18, 2016, 12:45:49 pm »
It also seems the camera on the raspberry openluup shows less attributes(eg user, password are missing).

You can, of course, create any attributes (or variables) that you need and set them to what you want.

As mentioned previously, it's AltUI, not openLuup that actually generates the image requests.
« Last Edit: April 18, 2016, 12:52:36 pm by akbooer »
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 akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup: Video, Cameras, ...
« Reply #26 on: April 18, 2016, 01:01:36 pm »
Can you clarify further: are you talking about a camera installed directly on openLuup or one bridged from a remote Vera?
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 delle

  • Full Member
  • ***
  • Posts: 134
  • Karma: +3/-0
Re: openLuup: Video, Cameras, ...
« Reply #27 on: April 18, 2016, 03:51:30 pm »
camera is installed on vera. works well with altui/openluup on vera but not when bridged. don't understand why attributes are changing in between

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup: Video, Cameras, ...
« Reply #28 on: April 18, 2016, 04:07:34 pm »
It turns out that the bridge doesn't copy username and password.  These, amongst others, are truly weirdly treated in Vera, appearing both in attributes and in the luup.devices structure under different names.  The inconsistencies in Vera are absolutely staggering - clearly written by many different people over an extended timescale with no documentation about the implementation or use cases.  I am frankly surprised to have got as far as we have.

It can, of course, be fixed.  Like most of the poorly implemented aspects, it's because I don't have the device in question, so can't try it out.
« Last Edit: April 18, 2016, 05:00:51 pm by akbooer »
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 akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup: Video, Cameras, ...
« Reply #29 on: April 18, 2016, 05:00:37 pm »
It can, of course, be fixed.

Development branch updated on GitHub.
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.