Samsung SmartCam: SNH-P6410BN, SNH-E6440BN and SNH-1011ND (+WWW Digest auth) (tested and working)

Hey guys,

After reading this forum for a while, I’ve noticed there is no good solution for two problems:

  1. WWW Digest authentication
  2. Samsung SmartCam SNH-P6410BN (possibly other SmartCams too, although I don’t have them)

As you suspect camera is using digest auth. For more details here is a good wiki link to read about it: http://en.wikipedia.org/wiki/Digest_access_authentication#Overview .

I’ve used @pstuart bits and pieces from generic camera, then added implementation for SmartCam and www digest auth.

There are some weird limits in the API through physicalgraph.device.HubAction, so Digest authentication is working via 2-step click. It’s just to get the token, but then it’s all about just one click to get the picture.

You can get the code here: https://github.com/KowszewiczGrzegorz/SmartThings/tree/master/Devices/Samsung%20SmartCam%20SNH-P6410BN

Enjoy!
Greg

6 Likes

I’m trying this out on my Samsung SNH-1011ND. I have no idea if it uses the same mechanism that you coded for, but a few questions.

I couldn’t get it to work out of the box. I can access the camera on my web browser with a local address (192.168.x.x). But in the logs, the auth token is always empty.

How does it work with local IP addresses? I would have thought that the device code executes in the SmartThings cloud, and I need to open ports on my firewall and use the external IP for my router. Or does the device code actually run on the hub?

There are a few possible options here. Unfortunately I don’t have SNH-1011ND cam, so I cannot test it directly, but maybe I can still help here.

Can you run wget/curl or chrome and save all of the headers that are being sent to and received by your camera with username and password? It’s possible this camera has a different type of authentication (basic?). Also, what’s the url that you can open in your browser to see the static image? Is it the same as SNH-P410BN ( “/cgi-bin/video.cgi?msubmenu=jpg&resolution=2” )? Do you see just a picture when you open it (nothing else on the page, it shouldn’t be a html page)?

Also, the connection itself runs through the hub, so you don’t need to open firewall ports to make it work.

Thanks for the reply. I’ll have to do some debugging with my browser and maybe even Wireshark. When I go to the camera’s local Web page i get a login screen with just a password, no user. From there I get pages that have similar functionality to the phone app.

The phone app has a button to take a picture so if all else fails I can probably snoop the traffic.

It would be great if I can get this to work. What would be even better is if Samsung provided native support for their ip cameras in SmartThings.

It works!!! Not sure what I did wrong before, but after an afternoon messing with PostMan / Wireshark, hacking a bit, etc, I finally uninstalled the device, re-installed it, changed the prefs and it worked fine with your original code.

Great job!

So I have verified that I can see a picture when I hit the “Take” button in the SmartThings app for the device. I have a Samsung SNH-1011ND which was sold at Costco, so I would not be surprised if a couple other folks here have that camera.

Is there any documentation about which HTTP requests the camera works with? I would be tickled pink if I could get motion alerts from the camera. Or be able to set the camera’s motion detection events on and off based on the Hello Home state.

Excellent. Congratulations! I’m glad to hear it’s working for you.

There is no documentation whatsoever about it’s own endpoints, but I’m working on it… I’m looking a bit ‘closer’ at the cam. I’ve discovered new endpoints that could be quite helpful. I will update this thread soon.

1 Like

ok, progress… I do have root access on the device now.

[root@WN3 ~]# cat /proc/cpuinfo
Processor : ARMv7 Processor rev 2 (v7l)
BogoMIPS : 398.95
(…)

[root@WN3 ~]# uname -a
Linux WN3 2.6.33.20 #2 PREEMPT Mon Jan 20 19:52:06 KST 2014 armv7l GNU/Linux

I don’t see any endpoints that could be helpful for your case @Dan999 without modifying the code on the cam itself. For your case… you can use ifttt.com site. The chain that I was thinking about goes like this: if there is a motion on the cam, send e-mail to your gmail account. Then, through ifttt.com if there is an e-mail with a subject that matches your camera subject (i.e. motion detected), then trigger some http endpoint to update your presence status. That would work quite well.

Hope that helps.

Sounds good. I’m not really interested in a presence sensor, more an immediate motion sensor, for which the delay of IFTTT is too great.

However, the main thing would be to be able to turn the camera motion detection on and off via an endpoint. That would allow me to set up the camera to record video to Google Drive but then only do that when the SmartThings presence shows as away. Someone else had achieved that using IP camera software running on a tablet, which has a web server on the one end and talks to various cameras on the other end. He then made a virtual switch device which calls the IP camera web service to turn detection on and off. I would like to achieve the same, but directly talk to the camera without another piece of third party software.

So please post if you discover any interfaces that allows one to toggle motion or audio detection on and off.

That makes sense. Do you know if the description you gave is publicly available on gist/github/etc?

On the other hand… good news! I figured it out that for you.

Here is the endpoint that you’re looking for:
to enable motion detection:
http://your_camera_ip:port/cgi-bin/event.cgi?msubmenu=motion&action=apply&device=1
to disable it:
http://your_camera_ip:port/cgi-bin/event.cgi?msubmenu=motion&action=apply&device=0

to enable audio detection
http://your_camera_ip:port/cgi-bin/event.cgi?msubmenu=audio&action=apply&device=1
turn it off:
http://your_camera_ip:port/cgi-bin/event.cgi?msubmenu=audio&action=apply&device=0

You should see “OK” string after each successful call.

Please verify if that works by going to the camera interface and see if the state changed by refreshing the page after you’ve changed the state. Try that in your browser of course and if that works we will go from there.

That’s great! Thanks for posting the info. I’ll try it tonight and see how it works and post the results here.

http://hit-mob.com/forums/viewtopic.php?f=8&t=5714&p=7373

I get a “NG” response if I try your requests above. If I use “/cgi-bin/event.cgi?msubmenu=analysis&action=view” I get a large set of parse errors and a bit of data. So I don’t think my camera supports the “motion” interface.

I found this: Samsung camera API doc, which is why I tried the analysis command… Neither of our camera model numbers are listed in the document, but I’m sure it will provide some information to continue the research :).

I don’t have your camera, but lets give it a try one more time.

How about /cgi-bin/event.cgi?msubmenu=motion&action=apply&device=on ?

Same response: NG. My camera seems to respond to msubmenu=analysis, but not msubmenu=motion. I’m also doing some more Googling / hacking, but no results yet.

When I snooped the traffic between the web page served by the camera, the camera responds to a POST of a 10k page of hex numbers. I have the Java script that formats the response (from the web page), but I was hoping to have a simple GET to access the motion detection on/off.

The POST seems to capture all of the data in the Web UI and packs it into a large string of numbers, to set the motion, event schedule (days, hours, etc), sensitivity, etc, etc, all into one large byte array.

I would assume the other Smartcam devices use very similar set up. Has anyone tried this on the outdoor version? I want to integrate 2 or them. Thanks

1 Like

Yes, I’ve checked that with SNH-E6440BN (outdoor version) and it’s working well. However, I had to return my camera as it was not as reliable as SNH-P6410BN is. The outdoor one was losing IP after a few hours. Then, I had to reboot it to fix it and it was down again and again… I’ve changed routers and it was the same behavior. Possibly it was a broken unit, so I returned it.

Great work! DAA is a very under supported protocol especially considering Techwin’s mutual relationship with SmartThings.

I integrate all of my cameras with Blue Iris and iSpyConnect. If you want to get the most cameras with the largest install base, please figure out how to support ONVIF! Its an open protocol and almost all high end system has some sort of support for it now. Techwin is a member as well.

Thanks!

Samsung documents their http api as “Samsung network device reference for all models” or you may find a copy under a 2012 version searching for “STW_NETWORK_DEVICE_HTTP.RTP.RTSP_v2.7.3_en” I’ve found the indoor 6410 supports most of the commands, including face detection enable! The outdoor 6440 current firmware seems incomplete. Perhaps newer firmware will finish implementing samsungs standard network api. I hope this helps and wasn’t something you already had your hands on.

I’ve noticed the outdoor model hangs up when using a brand new Motorola access point, loses IP, etc but switching back to my AirPort Extreme, zero issues for a few weeks now. Got them on 50% off sale at radio shack. Great cameras at that price.

update: ~5 months later

after using SNH P6410BN every day for couple of months I have to say it’s one amazing camera. It doesn’t hang, not losing signal, not dropping wifi connectivity (and if it does it’s my router that I’m restarting, but immediately after camera can connect). It has rtsp stream that I’m saving to one of my hard drives (essentially I’m using it as my free dropcam with HLS stream). For this price? Reliability of this little fecker is AWESOME.

On the other side, the outdoor camera is terrible. I’ve returned it. It wasn’t reliable at all. It was losing signal after anything between few hours to days without reconnecting back to the network. I think it’s more of the firmware issue than the hardware, but it would be good if it can be addressed.

I got a new Samsung SNH-E6413BN yesterday at Costco for $100. It has a beautiful picture compared to my SNH-1011ND and was a breeze to set up with the Samsung SmartCam app. However, it does not seem to work with this device type. I don’t get a picture with the camera path as set, even using web tools.

Has anyone had any success with this camera?

1 Like