SmartThings Community

New Device Type Handler for an IP addressable device: How to add your own device type to SmartThings from code

devicetype
codes
communitydevices

(JZst) #1

I was extremely frustrated that these instructions don’t exist and ultimately I could not find anything that gave me straight forward steps. Now that I’ve finally figured it out (computer nerd of 23 years, sad that it wasn’t as straight forward as I hoped) and now am able to document it for the community as no n00b is going to be able to figure this out as it’s just not simple enough to make sense right from the get-go — now it totally does though.

These instructions will walk you through adding a custom device handler (like driver in Windows and a little app to control the driver) but most-importantly, I will show you where to select it from a drop-down when creating a new device.

My needs revolved around D-Link cameras, 2 models: DCS-5010L and DCS-932L so my example will just use one of those but here are the two links to custom device handlers that easily made my cameras work on a LOCAL IP not through an open port on my firewall like I saw in other code samples:


This ST FAQ hinted me off a bit in step DT5 but until it clicked in my head, I had no success: FAQ: An Overview of Using Custom Code in SmartThings (SmartThings Classic)
DT5) Once the Device Type is published in your own library, select MY DEVICES in the IDE and choose the specific device you want to have use that new device type.

Steps to Create a New Device Type Handler:

  1. Log into ST API website
  2. On top press My Device Handlers
  3. On the right, click green button called New Device Handler
  4. On top, choose the From Code tab, paste your code and click CREATE button at the bottom
  5. The IDE will pop up with your new code. On top press Publish > For Me and now the device should be available as in the TYPE drop-down when you go to My Devices.
  6. Go to My Devices, press large green button on the right called New Device
  7. Give it a name and any unique device network ID like the device name. I gave my camera the name and ID of dcs5010l for instance. The most important piece is to scroll down in the TYPE drop-down and finally select your CUSTOM device type handler.
  8. The device will now appear in the ST application under Things.

Enjoy and feel free to comment so that I can alter my superior instruction set :slight_smile:

All the best!
JZ


Raspberry Pi with PHP (or Arduino/ESP8266/NodeMCU) to GPIO to Relay to Gate/Garage Trigger
Raspberry Pi with PHP (or Arduino/ESP8266/NodeMCU) to GPIO to Relay to Gate/Garage Trigger
(Michael) #2

Sorry you went through all that trouble. One of the community members spun up a Wiki to document things like this. Sorry you didn’t find these sooner, but these instructions are already posted:
http://thingsthataresmart.wiki/index.php?title=Using_Custom_Code#Using_a_Custom_Device_Handler

But you may find the other content useful as well.


(JZst) #3

Oh that is awesome, thank you for that! Sorry to duplicate info under the disguise of being helpful :slight_smile:


(Michael) #4

No worries on the duplicate. Honestly that is why the wiki was born because it’s hard parsing through tons of forum posts for instructions. Feel to contribute there too!


#5

It appears you were confused because you were working with an IP-addressable device rather than a device which would pair directly to the SmartThings hub like a Zigbee or zwave device.

Someone adding a Zigbee or zwave device would not use the “add new device” button because the device would already be paired. They just have to change the device type for that existing device.

I’m glad you figured out how to make it work for a device that cannot be paired through the “add new thing” process in the mobile app.

BTW, since you did find the forum thread on adding custom code, if you had posted a question there I’m sure someone would have helped clear up the confusion and you could have saved considerable time. The community is very open to questions. As you’ve noted, the forums can be pretty hard to navigate; we’ve all been there. :sunglasses:

Besides, you made an excellent point about the missing step for IP-addressable devices, I’ve updated the FAQ with it. SmartThings is very versatile, but rarely intuitive. Takes a while to cover all the bases!