Amcrest/Dahua Camera Plugin streaming and PTZ for openLuup/ALTUI
-
There are some annoying issues with my model. I can't even manage my camera's through Chrome or Firefox, only through IE.
Will try your new version soon.
-
I have tested the new version with my working model, but the buttons still do nothing. The error is gone and I don't see anything strange in the log.
2020-11-26 08:56:33.263 openLuup.server:: GET /data_request?id=lu_status2&output_format=json&DataVersion=377375215&Timeout=60&MinimumDelay=1500&_=1606377363201 HTTP/1.1 tcp{client}: 0x55f5f5b61a78 2020-11-26 08:56:33.642 luup.variable_set:: 10665.urn:upnp-org:serviceId:TemperatureSensor1.CurrentTemperature was: 19.60 now: 19.50 #hooks:0 2020-11-26 08:56:33.946 openLuup.server:: request completed (20648 bytes, 2 chunks, 682 ms) tcp{client}: 0x55f5f5b61a78 2020-11-26 08:56:34.059 openLuup.server:: GET /data_request?id=lu_status2&output_format=json&DataVersion=377375217&Timeout=60&MinimumDelay=1500&_=1606377363202 HTTP/1.1 tcp{client}: 0x55f5f5b61a78 2020-11-26 08:56:34.991 luup.variable_set:: 10664.urn:micasaverde-com:serviceId:HaDevice1.BatteryDate was: 1606377364 now: 1606377394 #hooks:0 2020-11-26 08:56:35.195 openLuup.server:: request completed (28287 bytes, 2 chunks, 1135 ms) tcp{client}: 0x55f5f5b61a78 2020-11-26 08:56:35.307 openLuup.server:: GET /data_request?id=lu_status2&output_format=json&DataVersion=377375219&Timeout=60&MinimumDelay=1500&_=1606377363203 HTTP/1.1 tcp{client}: 0x55f5f5b61a78 2020-11-26 08:56:37.593 openLuup.server:: GET /data_request?id=action&output_format=json&DeviceNum=297&serviceId=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveLeft HTTP/1.1 tcp{client}: 0x55f5f5fd7d88 2020-11-26 08:56:37.593 luup.call_action:: 297.urn:micasaverde-com:serviceId:PanTiltZoom1.MoveLeft 2020-11-26 08:56:37.593 openLuup.server:: request completed (60 bytes, 1 chunks, 0 ms) tcp{client}: 0x55f5f5fd7d88 2020-11-26 08:56:37.630 openLuup.client:: WGET error status: -1, request: http://admin:DWvBqx6yT7SkMogw@192.168.1.18/cgi-bin/ptz.cgi?action=start&channel=0&code=Left&arg1=0&arg2=1&arg3=0 2020-11-26 08:56:37.934 openLuup.server:: request completed (19020 bytes, 2 chunks, 2626 ms) tcp{client}: 0x55f5f5b61a78 2020-11-26 08:56:38.091 openLuup.server:: GET /data_request?id=lu_status2&output_format=json&DataVersion=377375220&Timeout=60&MinimumDelay=1500&_=1606377363204 HTTP/1.1 tcp{client}: 0x55f5f5b61a78 2020-11-26 08:56:38.733 openLuup.client:: WGET error status: -1, request: http://admin:DWvBqx6yT7SkMogw@192.168.1.18/cgi-bin/ptz.cgi?action=stop&channel=0&code=Up&arg1=0&arg2=0&arg3=0 2020-11-26 08:56:39.741 openLuup.server:: GET /data_request?id=action&output_format=json&DeviceNum=297&serviceId=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveRight HTTP/1.1 tcp{client}: 0x55f5f5fd7d88 2020-11-26 08:56:39.741 luup.call_action:: 297.urn:micasaverde-com:serviceId:PanTiltZoom1.MoveRight 2020-11-26 08:56:39.742 openLuup.server:: request completed (61 bytes, 1 chunks, 1 ms) tcp{client}: 0x55f5f5fd7d88 2020-11-26 08:56:39.775 openLuup.client:: WGET error status: -1, request: http://admin:DWvBqx6yT7SkMogw@192.168.1.18/cgi-bin/ptz.cgi?action=start&channel=0&code=Right&arg1=0&arg2=1&arg3=0 2020-11-26 08:56:40.280 openLuup.server:: request completed (19020 bytes, 2 chunks, 2188 ms) tcp{client}: 0x55f5f5b61a78 2020-11-26 08:56:40.424 openLuup.server:: GET /data_request?id=lu_status2&output_format=json&DataVersion=377375221&Timeout=60&MinimumDelay=1500&_=1606377363205 HTTP/1.1 tcp{client}: 0x55f5f5b61a78 2020-11-26 08:56:40.857 openLuup.client:: WGET error status: -1, request: http://admin:DWvBqx6yT7SkMogw@192.168.1.18/cgi-bin/ptz.cgi?action=stop&channel=0&code=Up&arg1=0&arg2=0&arg3=0 2020-11-26 08:56:41.476 openLuup.server:: GET /data_request?id=action&output_format=json&DeviceNum=297&serviceId=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveUp HTTP/1.1 tcp{client}: 0x55f5f5fd7d88 2020-11-26 08:56:41.476 luup.call_action:: 297.urn:micasaverde-com:serviceId:PanTiltZoom1.MoveUp 2020-11-26 08:56:41.477 openLuup.server:: request completed (58 bytes, 1 chunks, 0 ms) tcp{client}: 0x55f5f5fd7d88 2020-11-26 08:56:41.497 openLuup.client:: WGET error status: -1, request: http://admin:DWvBqx6yT7SkMogw@192.168.1.18/cgi-bin/ptz.cgi?action=start&channel=0&code=Up&arg1=0&arg2=1&arg3=0 2020-11-26 08:56:41.600 openLuup.server:: request completed (19020 bytes, 2 chunks, 1176 ms) tcp{client}: 0x55f5f5b61a78
The working model is the Amcrest IP4M-1051
-
I am not getting any of the WGET errors in my logs. I am not sure what this status -1 means besides the fact that the camera is rejecting the call. I am also a bit surprised that your credentials in the url are only partially encoded. (the username is doesn't appear to be). Something doesn't seem right.
Honestly I have not gotten to the bottom of the stream. One of my cameras which I just added has all the pan and tilt buttons work so it is communicated properly but the video does not show. I tested on firefox and none of the cameras show any images.
Will try to dig deeper into this as I think it is more java code from ALTUI than it is a plugin/openLuup problem. -
Alright so I made some progress with this. Sorry I am not very good in JS so it took me a while to understand how ALTUI handles this.
I have updated the plugin which should enable getting images from the camera if your browser has the ability to disable cross origin restrictions (i.e Safari "develop" menu). I have tested this on firefox as well but unlike safari, firefox somehow sends an URL without the credentials... which means that you won't be able to see your camera feed. I submitted a pull request to @amg0 to implement credentials in ALTUI.
-
Nice job figuring this out. Would this mean the feed of my older models would possibly work too? I'm getting a login screen sometimes when using the complete URL (with username and password) directly in my browser. That shouldn't happen, I would think.
-
Yes the older models would work too and yes you do need to get you browser to log in.
The reason is this:
All the plugin commands go from openLuup to the cameras. This should work without any problems.
The video stream however is a call from your client web-browser to the camera. This requires a separate login on top of the credentials which have already been established between openLuup and the cameras. The behavior obviously then varies a lot from browser to browser. For example Safari remembers the credentials so you only need to log in once and the call from ALTUI done by safari automatically adds the credentials. I discovered that firefox doesn't do that and requires the credentials to be added back in the url. -
O ok, thanks for the explanation. That's nasty. I use Chrome and that works similar as Firefox then. But what is the difference with the newer models then?
-
This was the very core of the design of ALTUI. The vera was very underpowered already so ALTUI moved the UI processing to the client browser using javascript instead of relying on the webserver on the vera (lightttpd). As the vera is properly incapable of processing high resolution camera streams, ALTUI moved that processing to the browser (and rightfully so) and therefore all the authentication must be done by the client browser.
By the way @amg0 has taken in my pull request so you can expect the next version of ALTUI to support this. I personally didn't notice any problem because I was using Safari. -
Yes, they should all work. It has for me. Check it out and see if you need any more help.
-
It's still not working for me. I don't get any image, also not from the newer model. And I don't get anything significant in the log files.
-
Sorry to hear. this is rather puzzling honestly as I have had no issues with mine. Getting the image is a simple API call to the camera. The only challenge was authentication of the credentials which required MD5/digest encoding and this has been fixed in openLuup.
The rest is about ALTUI working with your browser to display to image. Not sure where it is breaking for you. I have old and newer models and the aecrest API has not changed so it should make no difference. -
Bummer. I will dig into it some more later. No priority at the moment.