[OBSOLETE] D-Link DCS-942L Day/Night IP Camera DeviceType - Full Feature Support (Now With Video Streaming!)

##This DeviceType is Obsolete, Please use the following SmartApp instead:

##D-Link DCS-942L Device Type.

##Features:

  • In-App video streaming w/ sound
  • Still Image Capture and Display
  • Turn on/off motion detection (Motion & PIR combined)
  • Turn on/off PIR sensor (PIR Only)
  • Adjust motion sensitivity (Motion & PIR combined)
  • Toggle Night Vision On/Off/Auto
  • Turn on/off Video Recording to SD card

External Commands:

  • motionOn() - Video Motion Detection On
  • motionOff() - Video Motion Detection Off
  • pirOn() - PIR Motion Detection On
  • pirOff() - PIR Motion Detection Off
  • nvOn() - Night Vision On
  • nvOff() - Night Vision Off
  • nvAuto() - Night Vision Auto
  • vrOn() - Local Video Recording On
  • vrOff() - Local Video Recording Off

Prerequisites:

  • Fully configured DCS-942L camera on the same local network as your ST hub
  • Motion detection configured within local advanced camera settings (for motion detection / PIR sensor)
  • Email/FTP forwarding set up (for motion detection triggered pictures/video)
  • SD Card installed (for local video recording)

Installation Instructions:

  1. Copy the DeviceType below
  2. Go to ‘My Device Handlers’ in the SmartThings IDE
  3. Click the “Create New Device Handler” button in the upper right corner
  4. Click on the “From Code” tab and paste the GitHub code in the text box
  5. Click on the “Create” button in the bottom left corner
  6. Click on the “Save” and “Publish” → “For Me” buttons
  7. Go to the “My Devices” tab in the IDE
  8. Click on the “New Device” button in the upper right corner
  9. Fill in the Name, Device Network ID, Type, Location and Hub
  • Name will be what shows up in the ST app
  • Device Network ID can be anything, the DTH will change this automatically when used
  • Type will be where you select the DTH you just created, it should show as “DCS-942L”
  • Location will be whatever location this device is installed at
  • Hub will be the name of the hub on the same local network as the camera.
  1. Click the “Create” button
  2. Open the SmartThings App on your smartphone and go to the “Marketplace” tab
  3. Click on the “Not Yet Configured” button which should appear at the top of the list with a (1) next to it after a few seconds
  4. Click on the Camera
  5. Fill in all of the required information
  • Name will be what is shown in the Room and Thing views
  • Room will select which room the device exists in
  • Camera IP address should be the LOCAL IP address for the Camera
  • Camera Port should stay at ‘80’ unless you have personally changed it
    • This is the LOCAL HTTP Port for the camera
  • Video IP address should be the LOCAL or EXTERNAL IP address for the camera
    • If you use the Local IP you will only be able to view the video stream while on the same network or while using a VPN connected to the network the camera is on.
    • If you use the External IP you need to make sure you set up port forwarding through your router
      • WARNING: Port forwarding will make your camera open to the internet, anyone with your IP/Port and credentials will be able to view your camera.
  • Video Port should be the LOCAL or EXTERNAL RTSP PORT for the camera
    • If you use a local IP address you must use a local port, if you use an external IP address you will need to use an external Port (which port forwarding to the camera set up)
    • The default local RTSP port is 554
  • Camera User is the Username used to get into the advanced settings, default is ‘admin’
  • Camera Password is the Password used to get into the advanced settings
  1. All Done! Now enjoy the added functionality of your DCS-942L camera!

Compatible Custom SmartApps:


1 Like

will this work for other ip cameras…I mean p2p cameras

This code is set up specifically for the DCS-942L however you could edit it to work with other cameras by finding their HTTP commands and substituting them in the code.

I just updated my original post with updated code, this code has been cleaned up and also has had two of the user inputs removed.

Please let me know if this is/isn’t working for your DCS-942L

@blebson, I have been able to get this code working on my v2 hub. Is this just for pictures? Is there a way to get this to support video?

Hey Sean, as of right now the only support is for still pictures. ST hasn’t opened up their video streaming code yet so I don’t know if I’d be able to get that working as well or not. They have previously mentioned that these older D-Link models will not be officially supported because they don’t have the required technology built-in.

Hey blebson/Sean, I’m new to the development side of Smartthings. How are you actually connecting your DCS-942L to smartthings? My hub cannot seem to see it. Any assistance would be appreciated.

Hey @chewymid, you have to add the device in the ‘my devices’ tab in the IDE. From there you’ll assign the custom devicetype. Once you create the device manually you can fill in the local IP, local port, username and password within your smartthings app.

@blebson … Thanks! I got it working… good job on the coding! I’m looking forward at breaking down how you made this work! Thanks again!

Glad to hear you got it to work.

Just one thing to keep in mind, currently in the code the default ‘switch’ for this device turns on/off motion detection. It does not effect the PIR sensor which has it’s own on/off button. If you turn on/off motion detection when you change modes it will not effect the PIR setting, meaning if PIR is on you will still get motion detection emails. To solve this and use both sensors I tied the two together in my personal version of the code but left this one alone so you could chose how you want to use it.

@blebson… I’m fine with manually setting it up from its own interface as I have a mapped out motion area to capture. I was wondering if its possible to have the motion sensor read and alert just like a typical motion sensor? I have 2 of these camera facing outside and I would like to have alerts trigger upon movement. I have tried pointing motion sensors at a door thats 2 feet away from a window with no luck, just doesn’t pickup… but my camera records perfectly with any motion (within my set parameters). I can modify the code to strip out the toggle buttons and sensitivity toggle as for what i’m doing they are not required. Any advice of where to start?

The issue I see is that the camera doesn’t report to Smartthings unless it’s prompted by a command from the hub. There’s no way for Smartthings to ‘listen’ for motion detection from what I’ve seen.

Thanks for posting this – I was able to get my DCS-930L taking pictures using your device type!

Has anyone had luck tying a D-Link into the photo burst smart app?

I haven’t tried using the photo burst app, what I’ve done is set up the automatic e-mail feature of the d-link camera (using the local settings page) where it will email me 6 snapshots when the motion detection is active and senses motion. Then I have an IFTTT recipe which sends an alert to my Android Wear watch when I get an email that’s filtered into a ‘Security Camera’ folder in my Gmail account.

Thanks for the initiative, but I have an issue.

I’ve copied the script in a new device type and publish it. Now, I dont know how to create the device. Is there a “connect” smartapp?

Jean-Jacques

You’ll have to go to the ‘My Devices’ tab in the IDE and click the ‘+ New Device’ button in the upper right hand corner. Once in there you’ll fill in all of the field and choose the custom DeviceType from the drop down list. Make sure to fill in everything except for Label (optional), Zigbee ID (not applicable), and group (you’ll set this in the Smartthings app). For Device Network ID you can put any random letters and numbers in the field, the DeviceType will overwrite this field to get the camera to work.

Once you’ve created the device, go to your smartphone app and go to the Marketplace (bottom right-most button). You will see that there is a device listed under the ‘Not Yet Configured’ section, go in there and assign the camera to a room. Then go to the device in the Home Tab (second from the left on the bottom) and click the menu button in the upper right of the device screen. Click ‘Edit Preferences’ and then fill in all of the fields.

Hopefully this clears it up for you, let me know if it works.

1 Like

It is working. Thanks

JJ

Ben - Good stuff. I applied it to a 930L and the image taking works fine but not the switch for motion detection. I looked at the log, and it’s returning a “file not found” when firing the command to enable or disable (Cannot open URL(/etc_ro/web/config/motion.cgi,No such file or directory). Now if I enter “http://192.168.1.101/motion.cgi” in browser it returns

MotionDetectionEnable=0
MotionDetectionBlockSet=0011100111001110011100111
MotionDetectionSensitivity=80
MotionDetectionScheduleMode=0
MotionDetectionScheduleDay=127
MotionDetectionScheduleTimeStart=23:00:00
MotionDetectionScheduleTimeStop=23:30:00

Thinking the difference between the 930 and 942 api may only be the path and attribute names I tried “http://192.168.1.101/motion.cgi?MotionDetectionEnable=1” but that didn’t do it. Any ideas?

M

Try out this modified device type for the DCS-930L:

Fantastic. That works. You should get a commission from ST! I’m using the email feature built into the DLink. It’s been a while since I played with the custom smartapps, but I assume since you have the motion on/off as a switch i should be able to turn it on or off with a smartapp, say if mode changes to away to turn it on. Any tips or tricks in this regard are also appreciated.

Martin