We have moved at community.getvera.com

Author Topic: Trying to get an old Foscam off Vera onto OpenLuup  (Read 543 times)

Offline thierman

  • Sr. Newbie
  • *
  • Posts: 21
  • Karma: +0/-2
Trying to get an old Foscam off Vera onto OpenLuup
« on: January 07, 2018, 07:57:37 pm »
I actually thought this would be an easy one... but alas, being a newb to openluup, and lua, I'm stuggling...

Here are the details.

I have a FOSCAM  FI8602W on my veraplus currently using plugin I_FoscamPTZ.xml.

I've attached the I_FoscamPTZ.xml that I'm using.


I've installed the plugin in openlook as Plugin id:# 1978, this was what it was used on my vera and I didn't see any conflict when I went into user_data.json.
Code: [Select]
{
    "AllowMultiple":"1",
    "Approved":"1",
    "AutoUpdate":"1",
    "Files":[{
      "Compress":"1",
      "DestName":"I_FoscamPTZ.xml",
      "DestPath":"",
      "Encrypt":"0",
      "Role":"I",
      "SourceName":"I_FoscamPTZ.xml"
    }],
    "Hidden":"0",
    "Icon":"plugins/icons/1978.png",
    "Instructions":"http://code.mios.com/trac/mios_foscam-camera",
    "Title":"Foscam IP Camera",
    "Version":"11066",
    "VersionMajor":"2",
    "VersionMinor":"6",
    "id":1978,
    "timestamp":1376532738
  }


And created a device altuiid: 0-18 that has device file: "D_DigitalSecurityCamera2.xml" device_json: "D_DigitalSecurityCamera2.json" device_tyoe: "urn:schemas-upnp-org:device:DigitalSecurityCamera:2" and impl_file: "I_FoscamPTZ.xml"

Although I've forced attributes password, and username, and variables Username, and password to the correct values, those same values as used on the vera. What happens is that when, and this is where my understanding is weak, whoever manages the URL calls, fails to handle authentication correctly, such that my wireshark captures show the openLuup box trying to open a session, but getting back "HTTP/1.1 401 Unauthorized"

Where as the same code on the vera works and adds the "Authorization: Basic xxxxxxx\r]n" to the HTTP header.

What am I missing, is this something that is handled internally on the vera and not on openLuup, or is this just a case of not knowing what I need to change to make this work within OpenLuup.

In digging around the forums I saw some posts where others had gotten Foscam's to work with OpenLuup, so what is it that I'm missing....

Many thanks in advance.


From the logs:
2018-01-07 17:34:16.454   openLuup.scheduler:: [18] test cam device startup
2018-01-07 17:34:16.454   luup_log:18: FosCam-Startup:user:(xxxxxx) pass: (xxxxxxxx) ip: (192.168.100.63) url: (/tmpfs/snap.jpg) .
2018-01-07 17:34:16.454   luup_log:18: (test cam) State=-1
2018-01-07 17:34:16.454   openLuup.scheduler:: [18] test cam device startup completed: status=nil, msg=nil, name=nil

Here is output from Altui device state for camera:
Code: [Select]
{
  "altuiid": "0-18",
  "device_type": "urn:schemas-upnp-org:device:DigitalSecurityCamera:2",
  "states": [
    {
      "id": 1,
      "service": "urn:micasaverde-com:serviceId:Camera1",
      "value": "/tmpfs/snap.jpg",
      "variable": "URL"
    },
    {
      "id": 2,
      "service": "urn:micasaverde-com:serviceId:Camera1",
      "value": "1",
      "variable": "StepSize"
    },
    {
      "id": 3,
      "service": "urn:micasaverde-com:serviceId:Camera1",
      "value": "0",
      "variable": "ReversePan"
    },
    {
      "id": 4,
      "service": "urn:micasaverde-com:serviceId:Camera1",
      "value": "0",
      "variable": "ReverseTilt"
    },
    {
      "id": 5,
      "service": "urn:micasaverde-com:serviceId:HaDevice1",
      "value": "camera_up,camera_down,camera_left,camera_right,camera_full_screen,camera_preset,camera_archive_snapshot",
      "variable": "Commands"
    },
    {
      "id": 6,
      "service": "urn:micasaverde-com:serviceId:CameraMotionDetection1",
      "value": "-1",
      "variable": "State"
    },
    {
      "id": 7,
      "service": "urn:micasaverde-com:serviceId:Camera1",
      "value": "xxxxxx",
      "variable": "Username"
    },
    {
      "id": 8,
      "service": "urn:micasaverde-com:serviceId:Camera1",
      "value": "xxxxxx",
      "variable": "Password"
    }
  ]
}



Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: Trying to get an old Foscam off Vera onto OpenLuup
« Reply #1 on: January 08, 2018, 03:23:27 am »
What version of openLuup are you running?
What functionality do you expect to be able to use?
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 thierman

  • Sr. Newbie
  • *
  • Posts: 21
  • Karma: +0/-2
Re: Trying to get an old Foscam off Vera onto OpenLuup
« Reply #2 on: January 08, 2018, 11:41:12 pm »
Just installed openLuup January 1st. Looks like it's version 3.5 as the files in openLuup are all dated March 9th... I've attached the versions from the startup log.

I'm hoping to be able to display video from that camera, as I migrate I'm looking to be able to offload some of the load off my current vera. Thought this simple camera would be a good way to start moving things over and learning..

But with my failure, I was worrying that this was much harder than I had hoped.

However, since posting. I did find an github copy of the BlueIris.xml plugin, which has the motion sensor device. I installed that, and got that working through my blueiris. So, I guess, I don't really need the foscam plugin to work anymore, other than as a learning curve, so was hoping to understand why it wasn't working (specifically learn how authentication is being handled) so as to strengthen my understanding and be able to handle any issues that present themselves.

Love the work you've done. But, since I've had a very steep learning curve on this stuff, I thought I would put forward the question.



2018-01-08 21:23:20.366   openLuup.init::        version 2016.12.10  @akbooer
2018-01-08 21:23:20.383   openLuup.scheduler::   version 2017.02.22  @akbooer
2018-01-08 21:23:20.385   openLuup.wsapi::       version 2017.01.12  @akbooer
2018-01-08 21:23:20.385   openLuup.server::      version 2017.03.03  @akbooer
2018-01-08 21:23:20.388   openLuup.rooms::       version 2016.06.23  @akbooer
2018-01-08 21:23:20.391   openLuup.scenes::      version 2017.01.15  @akbooer
2018-01-08 21:23:20.393   openLuup.chdev::       version 2016.11.02  @akbooer
2018-01-08 21:23:20.393   openLuup.userdata::    version 2016.11.15  @akbooer
2018-01-08 21:23:20.394   openLuup.requests::    version 2017.02.05  @akbooer
2018-01-08 21:23:20.395   openLuup.io::          version 2016.11.09  @akbooer
2018-01-08 21:23:20.395   openLuup.luup::        version 2016.12.06  @akbooer

Thanks in advance...
            -C


Offline thierman

  • Sr. Newbie
  • *
  • Posts: 21
  • Karma: +0/-2
Re: Trying to get an old Foscam off Vera onto OpenLuup
« Reply #3 on: January 09, 2018, 01:17:55 am »
Unfortunately..... Although I can get the video to work, the device that represents the motion sensor doesn't receive the trips. You see, Blue iris calls a script, which connects to the "vera" in this case openLuup to inform the device of a trip. But here is what I see when it tries with openLuup.... From wireshark:
GET /data_request?id=lr_blueiris_tripped&test=A&sensor_id=20 HTTP/1.0
 User-Agent: Wget/1.11.4
 Accept: */*
 Host: 192.168.1.129:3480
 Connection: Keep-Alive

HTTP/1.1 501 Not Implemented
 Access-Control-Allow-Origin: *
 Content-Length: 156
 Connection: keep-alive
 Content-Type: text/html
 Server: openLuup/2017.03.03

 <!DOCTYPE html>
 <html>
   <head><title>501 - Not Implemented</title></head>
   <body><p>No handler for
 data_request?id=lr_blueiris_tripped</p></body>
 </html>

Offline thierman

  • Sr. Newbie
  • *
  • Posts: 21
  • Karma: +0/-2
Re: Trying to get an old Foscam off Vera onto OpenLuup
« Reply #4 on: January 09, 2018, 02:07:21 am »
Oops... never mind.... Didn't see the error in the log... made a change to the XML file and made a typo.... fixed...

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: Trying to get an old Foscam off Vera onto OpenLuup
« Reply #5 on: March 25, 2018, 02:05:06 pm »
How did this go?

You might want to try the new openLuup camera implementation file and set up email triggers, if your camera supports that.
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.