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

Strange one…or maybe not.

I am running this code and device for a D-LINK DCS-2210 camera.

Sure enough - I can press the TAKE button and it grabs a photo.

The problem is the photo it takes (or displays) is from hours earlier in the day. How does it even do that!

If I take a photo at night (i.e it is dark and the curtains are closed) it shows a shot of the day time (curtains are open).

I would like to try and figure out the timing delay on the photo it is showing. But not sure how yet.

I am based in the UK - so not sure if it is some timezone type conundrum.

Also - when you do TAKE the snaps - how do you delete the entries that are there? Is there a way to do this?

This is all based on Amazon s3 puts that go from the camera, to hub, to cloud, to s3 bucket, back to cloud, back to mobile device…

What you are seeing is the sequence of images that the mobile device has access to in the s3 bucket. The image that probably shows up is the 2nd to last one that was taken.

Since you are in the UK, I have no idea if S3 is supported for image carousel or not. The fact that it is even working at all for you is surprising. This hasn’t been working for me, corrupt images, failed to transmit to s3, etc. since hub v2 has launched.

I wish I could help, but there is nothing on the devicetype I can do, its all platform and what we are using is undocumented and unsupported.

Thanks for the response Patrick!

It definitely works in terms of taking the picture.
Just that the picture is many hours old…

Oh well - back to the drawing board.

Hi all!

Just found this amazing thread and I first of all have to thank Patrick for his work.

I have a Xiaomi Ants Camera which is dirt cheap with great image quality. Best VFM I have ever seen.

I have downgraded the camera’s FW so that I can access the rtsp (no authentication required) feed. The port is 554.
I have total access to the camera telnet, FTP, you name it.

I would love to integrate this cam into my Smartthings (v2 Hub) setup.
Can this be done? Can I have rules that utilize the camera?

I know I should read the thread first, but I would really appreciate it if someone could point out what can(not) be done.

Thank you very much in advance

UPDATE:

The rstp feed of the Xiaomi cam is: rtsp://192.168.31.238:554/ch0_0.h264
My settings are correct.

When I try to take a picture from within the iOS app it says “taking” and stays there for a while.
Nothing happens.

You may see the logs bellow:

e843339e-91e2-4d6b-ae7f-b6548e4013e1 ‎11‎:‎35‎:‎51‎ ‎πμ: debug Parsing ‘index:03, mac:B0D59D226D5A, ip:C0A81FEE, port:022A, requestId:17db12c8-fe33-4d01-9ab7-0d73d3459686’

e843339e-91e2-4d6b-ae7f-b6548e4013e1 ‎11‎:‎35‎:‎43‎ ‎πμ: debug GET /ch0_0.h264 HTTP/1.1
Accept: /
User-Agent: Linux UPnP/1.0 SmartThings
HOST: 192.168.31.238:554

e843339e-91e2-4d6b-ae7f-b6548e4013e1 ‎11‎:‎35‎:‎43‎ ‎πμ: debug The method is GET

e843339e-91e2-4d6b-ae7f-b6548e4013e1 ‎11‎:‎35‎:‎43‎ ‎πμ: debug The Header is [HOST:192.168.31.238:554]

e843339e-91e2-4d6b-ae7f-b6548e4013e1 ‎11‎:‎35‎:‎43‎ ‎πμ: debug Uses which method: GET

e843339e-91e2-4d6b-ae7f-b6548e4013e1 ‎11‎:‎35‎:‎43‎ ‎πμ: debug Requires Auth: false

e843339e-91e2-4d6b-ae7f-b6548e4013e1 ‎11‎:‎35‎:‎43‎ ‎πμ: debug path is: /ch0_0.h264

e843339e-91e2-4d6b-ae7f-b6548e4013e1 ‎11‎:‎35‎:‎43‎ ‎πμ: debug The device id configured is: c0a81fee:022a

e843339e-91e2-4d6b-ae7f-b6548e4013e1 ‎11‎:‎35‎:‎43‎ ‎πμ: debug 022a

e843339e-91e2-4d6b-ae7f-b6548e4013e1 ‎11‎:‎35‎:‎43‎ ‎πμ: debug IP address entered is 192.168.31.238 and the converted hex code is c0a81fee

By the way, I am not connected to my local network via my home router now that I am trying.
Could this be relevant?

To take a picture you need a camera path (URL) that returns an image. It sounds like you’re trying to use the live video stream, which will not work with this device type.

Oooooops. I was thinking that when it grabs the feed it would kind of freeze the first frame and use this one.

Thanks for this generic camera device, I successfully get it working with one of my Ubiquiti cameras, however when I try to add a second one, I get this in my log when I issue a take command:

25675510-c19c-4a4a-9149-c27b72a2533b 10:00:04 PM: error grails.validation.ValidationException: Validation Error(s) occurred during save():

  • Field error in object ‘physicalgraph.device.Device’ on field ‘deviceNetworkId’: rejected value [c0a80102:1ba8]; codes [physicalgraph.device.Device.deviceNetworkId.unique.error.physicalgraph.device.Device.deviceNetworkId,physicalgraph.device.Device.deviceNetworkId.unique.error.deviceNetworkId,physicalgraph.device.Device.deviceNetworkId.unique.error.java.lang.String,physicalgraph.device.Device.deviceNetworkId.unique.error,device.deviceNetworkId.unique.error.physicalgraph.device.Device.deviceNetworkId,device.deviceNetworkId.unique.error.deviceNetworkId,device.deviceNetworkId.unique.error.java.lang.String,device.deviceNetworkId.unique.error,physicalgraph.device.Device.deviceNetworkId.unique.physicalgraph.device.Device.deviceNetworkId,physicalgraph.device.Device.deviceNetworkId.unique.deviceNetworkId,physicalgraph.device.Device.deviceNetworkId.unique.java.lang.String,physicalgraph.device.Device.deviceNetworkId.unique,device.deviceNetworkId.unique.physicalgraph.device.Device.deviceNetworkId,device.deviceNetworkId.unique.deviceNetworkId,device.deviceNetworkId.unique.java.lang.String,device.deviceNetworkId.unique,unique.physicalgraph.device.Device.deviceNetworkId,unique.deviceNetworkId,unique.java.lang.String,unique]; arguments [deviceNetworkId,class physicalgraph.device.Device,c0a80102:1ba8]; default message [{0} must be unique]
    25675510-c19c-4a4a-9149-c27b72a2533b 10:00:04 PM: debug GET /api/2.0/snapshot/camera/35113fb1-2e00-3f50-82b2-6c8bc1c05d7f?force=true&apiKey= HTTP/1.1
    Accept: /
    User-Agent: Linux UPnP/1.0 SmartThings
    HOST: 192.168.1.2:7080

25675510-c19c-4a4a-9149-c27b72a2533b 10:00:04 PM: debug The method is GET
25675510-c19c-4a4a-9149-c27b72a2533b 10:00:04 PM: debug The Header is [HOST:192.168.1.2:7080]
25675510-c19c-4a4a-9149-c27b72a2533b 10:00:04 PM: debug Uses which method: GET
25675510-c19c-4a4a-9149-c27b72a2533b 10:00:04 PM: debug Requires Auth: null
25675510-c19c-4a4a-9149-c27b72a2533b 10:00:04 PM: debug path is: /api/2.0/snapshot/camera/35113fb1-2e00-3f50-82b2-6c8bc1c05d7f?force=true&apiKey=
25675510-c19c-4a4a-9149-c27b72a2533b 10:00:04 PM: debug The device id configured is: c0a80102:1ba8
25675510-c19c-4a4a-9149-c27b72a2533b 10:00:04 PM: debug 1ba8
25675510-c19c-4a4a-9149-c27b72a2533b 10:00:04 PM: debug IP address entered is 192.168.1.2 and the converted hex code is c0a80102

Any thoughts? It has a different Device Network ID than the other one, I have also tried removing and re-adding the device.

Ahh I read up a bit on how the DNI is set. I am grabbing images from Ubiquiti’s NVR software, which is the same IP:PORT for every camera I am trying this with… The path to the image ends up being different for each… So since the DNI is dynamically set based on the IP:PORT, each of these devices I set up has the same DNI. Am I reading that correctly? Is there a workaround for this in my use case?

The way the hubaction command works it requires you to have your device ID set as your IP:Port in hex. You might be able to modify the device type to set the device ID back to some placeholder after running the command…

You will need to write a SmartApp service manager app to get all camera photos and route them to the devices.

This devicetype will only work when ip:port is unique.

Patrick thanks, I was able to find a workaround that just involved port proxy’ing some additional ports to loopback to my Ubiquiti airvision server, so that I could specify a couple different ports and have them hit the same service.

I have noticed some strange behavior of s3 not firing the majority of time. Has anyone else been experiencing sporadic behavior using this recently? This is all I seem to get:

f440e8bd-5abc-4d79-9d54-f51df7b31362 4:27:03 PM: debug GET /api/2.0/snapshot/camera/ad8b8451-d7ea-3ea6-bfd2-9ca2b21a352b?force=true&apiKey=redacted HTTP/1.1
Accept: /
User-Agent: Linux UPnP/1.0 SmartThings
HOST: 192.168.1.2:7084

f440e8bd-5abc-4d79-9d54-f51df7b31362 4:27:03 PM: debug The method is GET
f440e8bd-5abc-4d79-9d54-f51df7b31362 4:27:03 PM: debug The Header is [HOST:192.168.1.2:7084]
f440e8bd-5abc-4d79-9d54-f51df7b31362 4:27:03 PM: debug Uses which method: GET
f440e8bd-5abc-4d79-9d54-f51df7b31362 4:27:03 PM: debug Requires Auth: false
f440e8bd-5abc-4d79-9d54-f51df7b31362 4:27:03 PM: debug path is: /api/2.0/snapshot/camera/ad8b8451-d7ea-3ea6-bfd2-9ca2b21a352b?force=true&apiKey=redacted
f440e8bd-5abc-4d79-9d54-f51df7b31362 4:27:03 PM: debug The device id configured is: c0a80102:1bac
f440e8bd-5abc-4d79-9d54-f51df7b31362 4:27:03 PM: debug 1bac
f440e8bd-5abc-4d79-9d54-f51df7b31362 4:27:03 PM: debug IP address entered is 192.168.1.2 and the converted hex code is c0a80102

Just wondering if anyone has any ideas what could be the cause or a no show here?

de54cbc7-732f-44fa-af03-6b03c6226c82 9:19:34 PM: debug POST /snapshot.cgi?user=#####&pwd=######## HTTP/1.1
Accept: /
User-Agent: Linux UPnP/1.0 SmartThings
HOST: 192.168.0.6:99

de54cbc7-732f-44fa-af03-6b03c6226c82 9:19:34 PM: debug The method is POST
de54cbc7-732f-44fa-af03-6b03c6226c82 9:19:34 PM: debug The Header is [HOST:192.168.0.6:99]
de54cbc7-732f-44fa-af03-6b03c6226c82 9:19:34 PM: debug Uses which method: POST
de54cbc7-732f-44fa-af03-6b03c6226c82 9:19:34 PM: debug Requires Auth: false
de54cbc7-732f-44fa-af03-6b03c6226c82 9:19:34 PM: debug path is: /snapshot.cgi?user=#####&pwd=########
de54cbc7-732f-44fa-af03-6b03c6226c82 9:19:34 PM: debug The device id configured is: c0a80006:0063
de54cbc7-732f-44fa-af03-6b03c6226c82 9:19:34 PM: debug 0063
de54cbc7-732f-44fa-af03-6b03c6226c82 9:19:34 PM: debug IP address entered is 192.168.0.6 and the converted hex code is c0a80006

I’ve hashed out the password for posting only - I can confirm that it is correct in the config.

Thanks
Dean

Can you please advise what WANSCAMS you are using as I have a cheapy £25 one and it will not work for the life of me.

using your latest code on Github all i get is “Please fill out all required fields” but everything is filled out

What device? The UI is pretty bad, sure you didn’t miss one of the thin red lines that indicate a required field?

its a Rosewill RSCM-120002 i double checked everything is green :frowning:

No, what mobile device? iOS or Android, specifics, What version of the mobile app of SmartThings… Does everything show up filled in the IDE under devices?

Its Android, i’m Using a hub v2 if that matters i dunno.
i just lost my cell signal… GRRR so i cant do much more triage ( i work in a huge building covered with zinc panels)

Works for me on Android, check your IDE devices settings, or capture a screen shot of the app and send it to me.

Does the network ID matter?