SmartThings Community

[OBSOLETE] D-Link DCS-5020L Tilt/Pan Day/Night IP Camera DeviceType (Now With Video Streaming!)

devicetype
communitydevices
cameras

(Ben Lebson) #1

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

##D-Link DCS-5020L Device Type

Features:

  • In-App Video streaming (Video Only, no sound)
  • Still Image Capture and Display
  • Full Pan/Tilt support
  • Move to ‘Home’ location
  • Move to Preset location (by preset number)
  • Turn on/off motion detection
  • Adjust motion sensitivity
  • Toggle Night Vision On/Off/Auto

External Commands:

  • motionOn() - Video Motion Detection On
  • motionOff() - Video Motion Detection Off
  • nvOn() - Night Vision On
  • nvOff() - Night Vision Off
  • nvAuto() - Night Vision Auto
  • left() - Move Camera Left
  • right() - Move Camera Right
  • up() - Move Camera Up
  • down() - Move Camera Down
  • home() - Move to ‘Home’ position
  • presetOne() - Move to Preset position 1 defined in DTH settings
  • presetTwo() - Move to Preset position 2 defined in DTH settings
  • presetThree() - Move to Preset position 3 defined in DTH settings
  • presetCommand( String preset-name ) - Move to Preset position (position name passed as a string)

Prerequisites:

  • Fully configured DCS-5020L 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)
  • Preset and Home positions configured within the local advanced camera settings

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-5020L”
  • 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 HTTP 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 HTTP port is 80
  • 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
  • Camera Preset 1-3 is the preset number which has been set up in the advanced settings
  1. All Done! Now enjoy the added functionality of your DCS-5020L camera!

Compatible Custom SmartApps:



D-Link IP Camera device type (DCS-930L tested)
DLink WiFi cameras, only limited ones supported?
Security Camera D-Link DCS-5009L
SmartApp accessing LAN device
New Device Type Handler for an IP addressable device: How to add your own device type to SmartThings from code
[RELEASE] Generic Video Camera DeviceType, Yes, Live Video Streaming
Suggest a Device
HI3510 IP Camera Device Type (Tenvis IPROBOT3, Instar, Wansview, others...)
Connect a Webcam to SmartThings?
Raspberry Pi with PHP (or Arduino/ESP8266/NodeMCU) to GPIO to Relay to Gate/Garage Trigger
(Aaron) #2

Anyone know if this will work with a 5029-l?

Thanks


(Ben Lebson) #3

The image capture looks like it will work but I don’t know about the motion detection or the camera movement buttons. I guess the only way to find out is to try it out and see. I’m looking to see if I can find the CGI commands for this camera but so far I haven’t found anything.


(Ben Lebson) #4

I just realized, the DCS-5029L is already officially supported by SmartThings, just go to the marketplace and go to Safety & Security -> Cameras -> D-Link -> D-Link 5029L Pan/Tilt Camera.


(Jason) #5

Please forgive my ignorance; I have just joined the SmartThings family. I jumped ship from Staples Connect the moment V2 was released. I also have a 5020L and would love to include it to my hub. Can you tell me how or point me to a FAQ on how to take this code and make it work on my hub? Thanks so much!


(Ben Lebson) #6

Welcome! I came from Staples Connect myself which is why I decided to write this deviceType. Here is a great FAQ about custom deviceTypes and SmartApps: FAQ: An Overview of Using Custom Code in SmartThings

Using this info you can add the devicetype using the smartthings IDE (graph.api.smartthings.com/ide). ST has a bit of a steep learning curve but it’s a whole lot more capable than staples connect was.


(Aaron) #7

I hope to try it tomorrow I’m not a programmer so no promises. Even though the camera is supported, that’s why I bought it and the v2 hub, none of those features are enabled I would love to take still photos to save data, or use the motion detector or pan the camera.

Thanks for posting this


(Ben Lebson) #8

Word of warning, currently this doesn’t save the photo permanently, just stores it on the cloud. You would have to rewrite how the photo is stored in order to save it permanently.


(Jason) #9

Thank you very much Ben, I will visit the link and give it a try!


(Aaron) #10

I tried it out, couldn’t get it to work but it is important to note I have no idea what I am doing :smile: Btw I should mention I am using D-Link DCS-5029L


(Jason) #11

Aaron, Like you I had the same result. Following the “FAQ: An Overview of Using Custom Code in SmartThings” I think I’m losing it at: DH6) Edit the Device so that it uses that device handler. I copied the code, made the device type and got it published. I made the camera in My Devices. But to edit the cam I made to use the device handler, I’m not understanding.


(Jason) #12

Silly me. I got it linked. After adding IP, user and password, and adding the cams IP to the DMZ on my router I can move the cam via smartthings app, but I have no video.


(Ben Lebson) #13

Video is currently not supported, the only thing you can do is take a still picture and display it in the top carosel.


(Ben Lebson) #14

Just added the capability to adjust the motion sensitivity of the camera. I was getting too many e-mails with pictures of a slight flicker of light through a window and wanted to be able to turn down the sensitivity during the day if I needed to.


#15

So I just had a few questions on these custom device types. First, where is the image being stored? Can I delete this image? Is it stored in the cloud or on the hub? Already tried deleting the device and device type. Image still stored somewhere as it shows up in the activity feed.

Second, how safe is the password sitting in plain text? Anyway to encrypt it so its just not plain text, you can clearly see it if you are in your hub/device under the preferences. Just wondering.


D-Link IP Camera device type (DCS-930L tested)
(Ben Lebson) #16

I changed the ‘Password’ field to be hidden text instead of being visible.

The image is stored in the smart things cloud, though I’m not 100% familiar with how it works. The images seem to only stay temporarily. I used code from other devicetypes to get that to work so I don’t really have many answers in regards to that. All I’ve done is add the ability to move the camera and turn on/off motion detection and adjust the sensitivity. I don’t know if there’s a way to store the pictures locally other than how you would normally do it outside of SmartThings using the D-Link app/website. Maybe @pstuart would know more about this?


(Ryan) #17

I’m also new to the code side so I may be doing something incorrect. But when I paste the code in I get an error:

No signature of method: script1445630693425914954975.metadata() is applicable for argument types: (script1445630693425914954975$_run_closure1) values: [script1445630693425914954975$_run_closure1@2137098c] Possible solutions: getMetadata(), getState(), setState(java.lang.Object), metaClass(groovy.lang.Closure)

Any help would be appreciated.


Source code for D-Link cameras?
(Ben Lebson) #18

Hey Ryan,

It looks like you inadvertently added it as a SmartApp, you need to add this code as a Device Type under ‘My Device Types’. This is a very common mix up for most people new to the IDE. :smile:

Let me know if you get it working once you switch it over to a Device Type.


(Ryan) #19

That’s the ticket! :grin:


(mhogey) #20

I have the 5029 set up using the officially supported setup you mentioned but the only tiles I get with it are refresh and reboot. Do I have to use the D-Link app to pan and tilt the camera? I would also love for the motion sensor in the camera to be used as a motion device for Smartthings. Is that possible?