Generic Camera Device using local connection (new version now available)

Hi Patrick

No, my device network ID is unique:

There is nothing else called “Test_Cam”

Thanks
Johan

Your dni needs to be the IP:PORT of the device in HEX or the MAC address. Test_Cam will not work.

I took the HEX address from live logging: It shows up as C0A8000A:0D29.
I edit my device, enter this value, and try to update, resulting in this:

I have tried on 2 different PCs; my work one as well as my local (to the hub; RDP) one with the same result.

Thanks
J

Patrick, figured out the error above…

It appears I did already have a DNI of IP:PORT in HEX for another camera device I set up a while ago.
I disabled this device, and all is now FULLY FUNCTIONAL with your code & device, and it is successfully pulling in a picture.

Just as an aside, when setting up the device in Device List, one can initially enter any DNI. When running/configuring the device on the phone, it appears to dynamically update the DNI with the HEX combo it requires. I noticed this after I went back in to change it that it was showing up correct.

Many thanks for your assistance with this.

J

Yes the code attempts to set the DNI, but over the years, ST has broken this ability to set a DNI in the app. So to start, you always should set it correctly to begin.

A question for you Patrick… (@pstuart)

I have partial success using your device type code…
The camera I am using is a Foscam C2, a colour 720p device
Also using Android for the app

Note passwords/ports etc. obscured with XOX0XOX; the string works 100% properly, everytime, in a browser!

SUCCESSFUL IMAGE CAPTURE; partial***
This is what I get in the log from the time I press “Take” until an image is produced. I can get this result every time I take an image IMMEDIATELY after I add as a new device, or remove the existing one & add it back again.

acddd101-4418-4f17-9897-9866bafa8da2 10:51:42 AM: debug hubActiveHandler(hubInfo)
acddd101-4418-4f17-9897-9866bafa8da2 10:51:39 AM: debug hubActiveHandler(register)
acddd101-4418-4f17-9897-9866bafa8da2 10:51:38 AM: debug hubActiveHandler(hubInfo)
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:51:36 AM: debug d90bd6c5108d457a89e44ace1cabfe6c
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:51:36 AM: debug firing s3
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:51:36 AM: debug Parsing ‘index:17, mac:XOX0XOX, ip:C0A8000A, port:XOX0XOX, requestId:0ad1cd56-3730-4ff1-81ee-31884f642210, bucket:smartthings-device-conn-temp, key:5af57a24-752b-40f5-a19d-c03cdd180bf5’
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:51:32 AM: debug GET /cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=XOX0XOX&pwd=XOX0XOX HTTP/1.1
Accept: /
User-Agent: Linux UPnP/1.0 SmartThings
HOST: 192.168.0.10:XOX0XOX
Authorization: Basic bnVsbDpudWxs

a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:51:32 AM: debug The method is GET
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:51:32 AM: debug The Header is [HOST:192.168.0.10:XOX0XOX, Authorization:Basic bnVsbDpudWxs]
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:51:32 AM: debug Uses which method: GET
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:51:32 AM: debug Requires Auth: false
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:51:32 AM: debug path is: /cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=XOX0XOX&pwd=XOX0XOX
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:51:32 AM: debug The device id configured is: C0A8000A:XOX0XOX
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:51:32 AM: debug XOX0XOX
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:51:32 AM: debug IP address entered is 192.168.0.10 and the converted hex code is c0a8000a

FAILED IMAGE CAPTURE
This is what I get in the log from the time I press “Take”, followed by “Taking”; it never actually finishes “Taking” but does eventually time out.

acddd101-4418-4f17-9897-9866bafa8da2 10:52:38 AM: debug hubActiveHandler(hubInfo)
acddd101-4418-4f17-9897-9866bafa8da2 10:52:35 AM: debug hubActiveHandler(register)
acddd101-4418-4f17-9897-9866bafa8da2 10:52:34 AM: debug hubActiveHandler(hubInfo)
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:52:28 AM: debug GET /cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=XOX0XOX&pwd=XOX0XOX HTTP/1.1
Accept: /
User-Agent: Linux UPnP/1.0 SmartThings
HOST: 192.168.0.10:XOX0XOX
Authorization: Basic bnVsbDpudWxs

a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:52:28 AM: debug The method is GET
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:52:28 AM: debug The Header is [HOST:192.168.0.10:XOX0XOX, Authorization:Basic bnVsbDpudWxs]
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:52:28 AM: debug Uses which method: GET
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:52:28 AM: debug Requires Auth: false
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:52:28 AM: debug path is: /cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=XOX0XOX&pwd=XOX0XOX
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:52:28 AM: debug The device id configured is: C0A8000A:XOX0XOX
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:52:28 AM: debug XOX0XOX
a531a3d0-9f53-4a19-ba49-210bb07e3f44 10:52:28 AM: debug IP address entered is 192.168.0.10 and the converted hex code is c0a8000a

Also, in a semi-successful image capture, a similar “corrupted” image shown below is always produced!

Let me know if I can prodive more info!

Thanks
Johan

EDIT: Note that the string entered in a browser always produces a perfect image

Open a ticket with support, not my problem, unfortunately. This is a flaw in the hub to S3 action which is a CORE API command, not part of my code.

Since the whole S3 process is undocumented and unsupported, I can’t do anything more with the code to fix it or work around it.

There doesn’t seem to be any priority at SmartThings to fix this method of getting local images via S3, hopefully a replacement method and process will be found soon. I’m not holding my breath.

I have 4 Hikvision camera’s that support going to a URL to get a live picture and trying to get it to work with ST. I am using the Generic Camera Device Handler and created a device and using these settings below:

Preferences (edit)
Name Type Value
CameraAuth bool true
CameraIP string 192.168.175.176
CameraPassword string *********
CameraPath string /Streaming/channels/1/picture
CameraPort string 80
CameraPostGet string GET
CameraUser string admin

If I go to this URL I have to authenticate then I get the picture so going through the browser works but I cannot get the device to work as it just gets stuck on “Taking” when I press that button.

095135d3-1550-46fa-90f9-47ca5ffb5ef0 12:24:34 PM: debug GET /Streaming/channels/1/picture HTTP/1.1
Accept: /
User-Agent: Linux UPnP/1.0 SmartThings
HOST: 192.168.175.176:80
Authorization: Basic *************************==

095135d3-1550-46fa-90f9-47ca5ffb5ef0 12:24:34 PM: debug The method is GET
095135d3-1550-46fa-90f9-47ca5ffb5ef0 12:24:34 PM: debug The Header is [HOST:192.168.175.176:80, Authorization:Basic YWRtaW46SXRpc21lMTk3NQ==]
095135d3-1550-46fa-90f9-47ca5ffb5ef0 12:24:34 PM: debug Uses which method: GET
095135d3-1550-46fa-90f9-47ca5ffb5ef0 12:24:34 PM: debug Requires Auth: true
095135d3-1550-46fa-90f9-47ca5ffb5ef0 12:24:34 PM: debug path is: /Streaming/channels/1/picture
095135d3-1550-46fa-90f9-47ca5ffb5ef0 12:24:34 PM: debug The device id configured is: C0A8AFB0:0050
095135d3-1550-46fa-90f9-47ca5ffb5ef0 12:24:34 PM: debug 0050
095135d3-1550-46fa-90f9-47ca5ffb5ef0 12:24:34 PM: debug IP address entered is 192.168.175.176 and the converted hex code is c0a8afb0

hikvision cameras images are too big for the hub to process and relay, plus other unfixed issues with ST. Sorry, can’t help much.

Hello Patrick! I’m trying to configure some cameras, foscam cameras, but I can’t do it yet… which code do I need to use? Because I tried a lot of codes, but without luck. Thanks in advance!

not sure what codes you are referring to, just need the path to the image the camera puts out.

For Foscam 9XXX cameras. Which code needs to use? And which path? I saw a lot of codes here, I tried, but nothing happened. I can’t see my cameras.

EDIT: Now im trying this one: https://github.com/skp19/st_foscam_universal/blob/master/st_foscam_universal.groovy

cb7b673f-cdad-4a77-8c4e-d15c38462b3f 13:31:50 GMT-3: debug params: [ts:1456676693129, stateID:1456676916320, _:1456676939841, access_token:XXX-XXX, appId:cb7b673f-cdad-4a77-8c4e-d15c38462b3f, param1:ping, action:[GET:executeSmartAppGet, POST:executeSmartAppPost, PUT:executeSmartAppPut, DELETE:executeSmartAppDelete, OPTIONS:executeSmartAppOptions], controller:smartAppApi]
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:38 GMT-3: debug Parsing 'index:18, mac:E8ABFA1A3D2B, ip:0A00012B, port:1F90, requestId:276a627f-06ce-4639-82e5-35ee249fec7d, headers:SFRUUC8xLjEgMjAwIE9LDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW4NClRyYW5zZmVyLUVuY29kaW5nOiBjaHVua2VkDQpEYXRlOiBTdW4sIDI4IEZlYiAyMDE2IDE2OjMxOjM0IEdNVA0KU2VydmVyOiBsaWdodHRwZC8xLjQuMzE=, body:PENHSV9SZXN1bHQ+CiAgICA8cmVzdWx0PjA8L3Jlc3VsdD4KICAgIDxjdHJsUmVzdWx0PjA8L2N0cmxSZXN1bHQ+CjwvQ0dJX1Jlc3VsdD4K’
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:38 GMT-3: debug Parsing 'index:17, mac:E8ABFA1A3D2B, ip:0A00012B, port:1F90, requestId:fedca2d1-5c50-4c99-aac1-088e5cb16004, headers:SFRUUC8xLjEgMjAwIE9LDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW4NClRyYW5zZmVyLUVuY29kaW5nOiBjaHVua2VkDQpEYXRlOiBTdW4sIDI4IEZlYiAyMDE2IDE2OjMxOjM0IEdNVA0KU2VydmVyOiBsaWdodHRwZC8xLjQuMzE=, body:PENHSV9SZXN1bHQ+CiAgICA8cmVzdWx0PjA8L3Jlc3VsdD4KPC9DR0lfUmVzdWx0Pgo='
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:36 GMT-3: debug /cgi-bin/CGIProxy.fcgi?usr=admin&pwd=XXXXXX&cmd=openInfraLed
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:36 GMT-3: debug Executing hubaction on 10.0.1.43:8080
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:36 GMT-3: debug Device Network Id set to 0a00012b:1f90
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:36 GMT-3: debug /cgi-bin/CGIProxy.fcgi?usr=admin&pwd=XXXXX&cmd=setInfraLedConfig&mode=1
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:36 GMT-3: debug Executing hubaction on 10.0.1.43:8080
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:36 GMT-3: debug Device Network Id set to 0a00012b:1f90
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:36 GMT-3: debug LED changed to: on
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:36 GMT-3: error org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog. @ line 458
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:36 GMT-3: debug Parsing 'index:18, mac:E8ABFA1A3D2B, ip:0A00012B, port:1F90, requestId:89d73559-abdd-45b9-beb0-404ca8c0b352, headers:SFRUUC8xLjEgMjAwIE9LDQpDb250ZW50LXR5cGU6IG11bHRpcGFydC94LW1peGVkLXJlcGxhY2U7Ym91bmRhcnk9VGhpc1N0cmluZw0KQ29ubmVjdGlvbjogY2xvc2UNCkRhdGU6IFN1biwgMjggRmViIDIwMTYgMDM6MTQ6MzIgR01UDQpTZXJ2ZXI6IGxpZ2h0dHBkLzEuNC4zMQ==, body:LS1UaGlzU3RyaW5nCkNvbnRlbnQtdHlwZTppbWFnZS9qcGVnCkNvbnRlbnQtTGVuZ3RoOjE3OTkzCgrvv73vv73vv73vv70AEEpGSUYAAQEAAAEAAQAA77+977+9AO+/vQAbEhQXFBEbFxYXHhwbIChCKyglJShROj0wQmBVZWRfVV1banjvv73vv71qce+/vXNbXe+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/vWfvv73vv73Juu+/vceZ77+977+977+9ARweHigjKE4rK07vv71uXW7vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv70CHB4eKCMoTisrTu+/vW5dbu+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/vQARCAHvv70C77+9AwEiAAIRAQMRAu+/ve+/vQHvv70AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKCxAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDLvv73vv73vv70II0Lvv73vv70VUu+/ve+/vSQzYnLvv70JChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl677+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+9AQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgsRAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjLvv70IFELvv73vv73vv73vv70JIzNS77+9FWJy77+9ChYkNO+/vSXvv70XGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eu+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/…[TRUNCATED]
cb7b673f-cdad-4a77-8c4e-d15c38462b3f 13:31:30 GMT-3: debug params: [ts:1456676693129, stateID:1456676916320, _:1456676939840, access_token:XXX-XXX, appId:cb7b673f-cdad-4a77-8c4e-d15c38462b3f, param1:ping, action:[GET:executeSmartAppGet, POST:executeSmartAppPost, PUT:executeSmartAppPut, DELETE:executeSmartAppDelete, OPTIONS:executeSmartAppOptions], controller:smartAppApi]
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:28 GMT-3: debug /cgi-bin/CGIProxy.fcgi?usr=admin&pwd=XXXXXXX&cmd=openInfraLed
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:28 GMT-3: debug Executing hubaction on 10.0.1.43:8080
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:28 GMT-3: debug Device Network Id set to 0a00012b:1f90
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:28 GMT-3: debug /cgi-bin/CGIProxy.fcgi?usr=admin&pwd=XXXXX&cmd=setInfraLedConfig&mode=1
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:28 GMT-3: debug Executing hubaction on 10.0.1.43:8080
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:28 GMT-3: debug Device Network Id set to 0a00012b:1f90
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:28 GMT-3: debug LED changed to: on
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:27 GMT-3: debug /cgi-bin/CGIProxy.fcgi?usr=admin&pwd=XXXXXXX&/decoder_control.cgi?command=94&
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:27 GMT-3: debug Executing hubaction on 10.0.1.43:8080
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:27 GMT-3: debug Device Network Id set to 0a00012b:1f90
3ca3a414-4d91-41bf-aabe-ab7a7e707988 13:31:27 GMT-3: debug LED changed to: off

No idea. Sorry. Can’t really offer end user support, especially when they aren’t using my code. Maybe try the person who wrote that devicetype?

Patrick, is your code… I take it from your github… I dont know…

Which is your code for foscam cameras?

Sorry, wish I could help, but my code does not have the log.debug statement LED changed to: on

Post the url to the github repo you grabbed the code from. I never wrote a foscam specific devicetype.

no idea, check the path in a regular browser, does it ask for a user name or password and does it return a picture or an html page?

Works well if I goes directly to http://ip:port/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=admin&pwd=XXXXX

Well, if it works in a browser, it should work in the app, try setting the auth to false, but still put in user and password and see what happens.

Hi Patrick thanks for your work on this. Trying to get it working with an Amcrest camera, and it looks like it is getting something back, but no image appears. Here’s what I’m getting:

4:28:26 PM: debug Parsing ‘index:17, mac:4C11BF3D22F0, ip:0A000108, port:0050, requestId:03fd305a-d738-49e3-86e3-96a79701174c’
4:28:25 PM: debug GET cgi-bin/snapshot.cgi HTTP/1.1
Accept: /
User-Agent: Linux UPnP/1.0 SmartThings
HOST: 10.0.1.8:80
Authorization: Basic REDACTED

4:28:24 PM: debug The method is GET
4:28:24 PM: debug The Header is [HOST:10.0.1.8:80, Authorization:Basic REDACTED]
4:28:24 PM: debug Uses which method: GET
4:28:24 PM: debug Requires Auth: true
4:28:24 PM: debug path is: cgi-bin/snapshot.cgi
4:28:24 PM: debug The device id configured is: 0A000108:0050
4:28:24 PM: debug 0050
4:28:24 PM: debug IP address entered is 10.0.1.8 and the converted hex code is 0a00010

If I paste the link into a browser it works once I log-in. Does the fact I’m getting a “Parsing” message mean the camera is returning an image, but nothing is coming back from S3? I turned down the resolution to 640x480. Thanks!

The parse means it got a response, but not something it could parse. Could be that the image is too large to parse to s3?