eclipse-archived / smarthome

Eclipse SmartHome™ project
https://www.eclipse.org/smarthome/
Eclipse Public License 2.0
862 stars 783 forks source link

OH 2.1 incompatibility with D- Link webcam #3870

Closed Dan1001 closed 7 years ago

Dan1001 commented 7 years ago

Since upgrading to 2.1, the image widget has stopped displaying images from a D-Link DCS-6511 webcam

The sitemap reads:

Image url="http://openhab@192.168.1.145/dms" refresh=200

The basicUI, classicUI and iOS app all fail to show the image, but there's no problem viewing it in a browser (on the same linux PC running openHAB). Nor does zoneminder (on another PC) have a problem viewing it.

The problem is definitely linked to 2.1 - I had it when I tried a 2.1 snapshot a few months ago, and it disappeared when I then reverted to 2.0. The problem then popped straight back when I upgraded to 2.1 a couple of weeks ago. More fool me for not reporting it first time round...

There is no error in the logs. Restarting openHAB doesn't help. I've no problem with other webcams (made by other manufacturers).

I appreciate it may be hard for others to duplicate the problem unless they have the same webcam - let me know and I can give you access to this webcam.

Dan

kaikreuzer commented 7 years ago

Your url only specifies a username, but not a password. Is that intended? It looks suspicious to me as usually credentials would require username AND password.

maggu2810 commented 7 years ago

Is this related to (a duplicate of) #3836

Dan1001 commented 7 years ago

I thought it might be a duplicate of #3836, but @skja thought it wasn't, and asked me to open a separate item. One obvious difference is that I get nothing in the logs.

You're right I'm not specifying a password - I thought the problem might be an authentication issue, so turned off passwords for that user... but it didn't make a difference.

triller-telekom commented 7 years ago

Since you are saying that your other webcams are working and I also checked that a picture on the web is showed and refreshed in my sitemap with this configuration

Text item=IP_Cam_1 {
            Image url="https://i.ytimg.com/vi/GNaAYKV5mIM/hqdefault.jpg" label="IP Cam 1" refresh=2000            
        }

I think that the problem might actually be your camera. Could you please run the openHAB instance with the debug start script and see if there is any output?

Dan1001 commented 7 years ago

Thanks - I'll try this evening. But, given I didn't have the problem with OH 2.0, and don't have it with zoneminder or a browser, doesn't it suggest there is something subtle going on with OH2.1 and this particular camera?

kaikreuzer commented 7 years ago

I thought the problem might be an authentication issue, so turned off passwords for that user...

Could you try turning off authentication completely and use http://192.168.1.145/dms as your url?

lolodomo commented 7 years ago

Please try removing the refresh parameter or increasing it (200ms looks very short). Try with 30000 to see if it makes a difference.

Mr-iX commented 7 years ago

I have increased the refresh time and tried the suggestion from @triller-telekom to load a other image from the internet. But none of them worked.

I think there is a problem with proxying the picture: Sitemap Code: Text item=IP_Cam_1 { Image url="https://i.ytimg.com/vi/GNaAYKV5mIM/hqdefault.jpg" label="IP Cam 1" refresh=2000 }

URL from the picture in OpenHAB (right click; copy picture url): https://openhab.fritz.box/proxy?sitemap=test.sitemap&widgetId=020100&t=1501156578933

Response when I open this link: error-page

Dan1001 commented 7 years ago

The camera won't turn off authentication unfortunately. Changing the refresh time doesn't work.

@Mr-iX's example also doesn't work for me. Nor does it work if I replace it with an http link, e.g. http://www.cats.org.uk/uploads/images/pages/photo_latest14.jpg . However I do get "cannot retrieve item for widget" errors in the log, which suggests this may be a different bug?

Dan

Mr-iX commented 7 years ago

I have tested it with the latest Snapshot version of OpenHAB, but also there the problem exists. Now I have downgrade to version 2.0 and now everything works fine.

I will stay on version 2.0 because it´s way more stable than the newer versions of OpenHAB.

Dan1001 commented 7 years ago

I've placed a bounty with bountysource in the hope that incentivises someone to fix this - sadly I don't have skills.

9037568 commented 7 years ago

I just tested this version of the url and it worked (using the release version OH 2.1.0 and the Classic UI). Clearly this is an oversimplified sitemap.

sitemap test1 label="Test 1"
{
    Frame label="Image" {
      Image url="https://i.ytimg.com/vi/GNaAYKV5mIM/hqdefault.jpg" refresh=200
    }
}

I did notice in the log a bunch of messages like this:

2017-08-09 07:59:26.347 [WARN ] [eclipse.jetty.servlet.ServletHandler] - /proxy
org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException: index=1, size=1
    at org.eclipse.emf.common.util.BasicEList.get(BasicEList.java:346)[64:org.eclipse.emf.common:2.11.0.v20150805-0538]
Mr-iX commented 7 years ago

Ok I have always tried the Basic UI. Can you please test it there as well?

9037568 commented 7 years ago

Tried Basic UI and it works also. And just for a little extra information, here's the generated image location in the UI: http://localhost:8080/proxy?sitemap=test1.sitemap&widgetId=0000&t=1502339207211

Dan1001 commented 7 years ago

Well that's interesting - doesn't work for me on Classic UI or basic UI. I created a blank sitemap with nothing except the above code, and I just get an empty frame. Nothing in the logs.

Dan

kaikreuzer commented 7 years ago

@Dan1001 I was able to reproduce the issue with a sitemap entry like

Image url="http://openhab@192.168.1.145/dms" refresh=200

The issue was that the current Proxy servlet expected always complete credentials (i.e. user:password@...) and failed adding an auth header in case no password was given.

4051 fixes the issue for me - I can ping you as soon as it is available in the openHAB distro for you to retest.

Dan1001 commented 7 years ago

Many thanks, but unfortunately I think I must have a different problem, as I moved to incomplete authentication thinking that might fix the problem - I originally experienced it will complete credentials. I also have the same issue with urls that don't require authentication, e.g. https://i.ytimg.com/vi/GNaAYKV5mIM/hqdefault.jpg (as above).

Mr-iX commented 7 years ago

Same for me, I also used an authentification with username and password, witch hasn’t worked.

kaikreuzer commented 7 years ago

@Dan1001 Please don't mix different issues here - the original issue was the support of urls like http://openhab@192.168.1.145/dms that is used by D-Link cams; this definitely didn't work, but is fixed now (already available in openHAB distro 1012, please test!).

FTR, I have also checked the cat picture with that latest build and it works smoothly as well:

screen shot 2017-08-15 at 10 28 01

Mr-iX commented 7 years ago

I can confirm that it works in the latest snapshots.

Have you got an ETA for openHAB 2.2? I don’t want to upgrade my productive environment to a beta/snapshot release.

kaikreuzer commented 7 years ago

Have you got an ETA for openHAB 2.2?

Nope, sorry. If we do not make any progress on a fully automatic build&release chain, it'll probably be in autumn - otherwise possibly earlier, but I am not too optimistic.

Mr-iX commented 7 years ago

I would be great if there where x.x.1 (and so on) releases, that fix some bugs, but don’t provide new features.

kaikreuzer commented 7 years ago

Right, exactly for this we require the fully automatic process :-)

Dan1001 commented 7 years ago

Unfortunately the latest snapshot hasn't fixed it for me. That cat example now works, but a simple sitemap displaying the webcam doesn't:

sitemap test label="Test" { Frame label="Image" { Image url="http://openhab@192.168.1.145/dms" refresh=1000 } }

Nor does it work with http://admin:[password]@192.168.1.145/dms. No errors in the logs.

The exact same links work fine in a browser (and worked on OH2.0). So this remains the same problem I posted at the start of this thread.

Let me know if I need to open a new issue - if so, I'd be grateful if you could let me know what other information I should provide.

kaikreuzer commented 6 years ago

Hey @Dan1001, glad to hear that the issue is solved for you as well after all!

triller-telekom commented 6 years ago

@kaikreuzer Are you sure that he has fixed his problem? In his last post he says that our example works for him but not the picture of his D-Link webcam. And the topic of this issue is that the D-Link webcam picture used to work in older OH setups and seems to be broken now :(

kaikreuzer commented 6 years ago

Yes I am sure, because I had a private post from him. And if you look at the fix, it clearly addressed the root cause of the issue, which was the handling of empty passwords.

Dan1001 commented 6 years ago

Actually that wasn't my root issue - it wasn't working after the upgrade to 2.1, then I made the password empty to test if that was the problem, and it still didn't work. Any bug around empty passwords was not the root cause. But the problem did disappear on some later snapshot.

triller-telekom commented 6 years ago

Alright, thank you for the background information.