[ST Edge] UPnP Control Point Driver

I’d like to share a project I’ve developed that provides a complete and robust UPnP control point library for writing Edge drivers. The audience for this package is developers that want to integrate LAN devices supporting the UPnP specification (partial or complete), as well as anyone else that is looking to learn how to use the new Edge platform to integrate LAN-based devices in general.

The package includes an example driver that you can use to explore and interact with existing UPnP devices on your LAN. SmartThings devices are created during discovery, and select UPnP attributes can be viewed on the device details screen in the mobile app. You never know what you may find on your LAN; I was personally able to find 14 devices that support UPnP on my home network (e.g. routers/extenders, IP cameras, streaming devices, smart TVs, Philips Hue hub, etc).

The package also includes a template file for writing your own driver using the UPnP library.

The library supports all UPnP 2.0-specified functions, including SSDP (discovery), device alive monitoring, event subscription, and control commands, as well as access to all UPnP device and service description data. The example driver demonstrates all of these capabilities.

Thorough documentation is available at this link. This is a good place to start if you want to determine if this package is for you.

The code is being distributed via github here: GitHub - toddaustin07/edge_upnp: UPnP library for SmartThings Edge device drivers

EDIT: A ‘UPnP Explorer’ driver is also available to install directly onto your hub via my channel: SmartThings. Add a little smartness to your things. More information in a related post below.

Caveat: Since Edge is still in beta, expect this package to evolve as fixes & adjustments are made in the underlying platform. However I intend to keep the library API constant to minimize any changes needed to drivers.

To anyone interested in trying this package out, I’m looking forward to your comments and feedback.


Great work @TAustin I will be sure to use this to help me learn all the cogs in the drivers setup.

1 Like

Very interesting project. I’d be interested to try this but not before it is available to install through channel. It’ll nice to know what this could find in my apartment. :thinking::grinning_face_with_smiling_eyes:

1 Like

Thanks for your comment! I’m initially distributing this through git since it’s really meant to be a library for developers rather than a turn-key driver for end-users. However I will explore the idea of turning the included example driver into more of a turn-key driver anyone could install via a channel just to do a ‘UPnP survey’ of their LAN.


I’ve had to make an update to the git package since I just found out that my package config file required some updates for the beta release (this was developed primarily during alpha). So please, if you tried this already and couldn’t get it to work, pull the latest package again to get the update and you should be good to go.

I get your point. Just let me know if you’re about to publish this through channel. I’ll be first to enroll.:blush:

1 Like

@Sakari and others with interest…

I have created a version of the example driver and published it via a channel as you suggested. This is the first time I’ve attempted this, so please let me know if this works for you or if you have problems.

I’m calling this example driver a ‘UPnP Explorer’, as it will identify all available devices and sub-devices supporting UPnP on your LAN. A detailed description of this driver, including how to decipher log messages, is available in the documentation link in my original post above.

Here is the invitation: SmartThings. Add a little smartness to your things.

I would recommended firing up a logging window so you can see the details of what is happening as the driver executes: once you finish using the web link above to install the driver from my channel to your hub, you can use the CLI to find out the driver ID and then start the logger:

smartthings edge:drivers:installed
smartthings edge:drivers:logcat <driverID> --hub-address=<hub ip addr>

You can then proceed to the mobile app and do an Add device->Scan nearby to initiate the UPnP device search. If you have any available, SmartThings devices will be created for each UPnP device found, with some selected UPnP attributes available to view on each device details screen.

Regarding the device details screen: As noted in the documentation, the Sequence Number will increment only for devices that were successfully subscribed-to. Expiration date is only updated when subscription events are received. For more complete realtime monitoring, see the log output.

If this ignites further interest in customizing the example or writing your own driver, the example code and UPnP library is all available on github per my original post.

I have been curiously following the Edge diver developments. So I connected to your channel to see how it works.
When I ran scan nearby it created 2 devices for my router: Actiontec “Broadband Router” and Lan Device. They both appear as switches. They are shown as on line but appear to have no function.
It was very easy to do.

1 Like

I found lot’s of stuff. Xbox, router, tv, etc. These kind of drivers have endless options and gives another dimension to SmartThings. Good start so far.

1 Like

Hi Paul - Thanks for trying it out! The SmartThings devices that get created are generic and all have switches. If your devices support subscriptions and send regular events then you’d see the switch toggle on or off each time a event is received, and the sequence number would increment. To really explore the services and commands that you could send to control the devices, you’d have to take a look at the device and service description XML and start customizing the driver for meaningful interaction. This driver blindly tries to subscribe to the first available service and doesn’t really try to actually control the device (that could be dangerous! :smirk:). See the documentation link for more info on all this. If you want to investigate further, I’d definitely recommend monitoring your log during discovery, watching for the XML retrieval URLs and then plugging them into a browser. Then you can see the gory details of all the services, commands, and device states that are available for each of your devices.

if there was a way to dynamically construct SmartThings devices, I could build a driver that parses the UPnP device XML and creates a device with the custom commands and associated arguments needed to exercise the available device services. But this is where I intended the curious developer to take over…

Great to hear, @Sakari! Thanks for letting me know you’re having success. :+1:t3:

OMIGOD!!! This is amazing. I have just spent a week trying to re-invent this sigh. Ah well at least I have learnt a lot and once I gave up on Windows for a lua environment I quite enjoyed it.

I’ve only just found this so I haven’t got very far, but I’'ll probably be thanking you again in a few days!!!

The documentation is superb! Can I buy you a beer?

1 Like

This looks awesome. Can’t wait to try it later today.

@TAustin post your Paypal/Venmo on the README in your github :wink:


Thanks for the enthusiasm and compliments. A beer sounds good to me! :smiley:

I assume that was you that posted the issue to my github. See my reply. I’ll get that fixed ASAP once I see what’s causing it. Probably a classic case of the device manufacturer deviating from the spec, but that’s ok. I want to make sure the driver can handle these cases, so I’m glad you found it. (I don’t have any Sonos devices myself to test)


Hmmmm, maybe I should think about doing that! :thinking:

1 Like

To let everyone know, I’ve had to make a fix to the UPnP libary to correct a problem parsing device description XML for UPnP devices with multi-tier subdevices. The error was occurring with Sonos and Denon audio devices, but could potentially happen with any multi-tier device.

Github has been updated, as well as the example driver available through my channel posted previously. Hubs should be updated by now with the update.

Thanks to @Davec for finding this issue!

I ran the UPnP Edge driver discovery this morning. Overall seemed to work well. A couple odd things:

  1. It seemed to create each device twice. Edit: looks like some devices have multiple upnp uuid ab\nd the driver creates one device per upnp uuid?
  2. Several error logs for a missing capability definition
    2021-09-20T16:19:40.674711412+00:00 ERROR UPnP Explorer Harmony Hub 2 thread encountered error: [string "init.lua"]:84: Capability partyvoice23922.upnpmodel version 1 definition not found

Thanks for the feedback!

  1. Yes, for any device that may have subdevices, a SmartThings device will be created for each; and yes, they each have their own UUID / UDN

  2. This one is concerning! To help diagnose this could you answer these Q’s?:

  • Are you running the channel driver or did you install yourself from the github package?
  • Did you get any devices actually created in SmartThings? If so, what fields are being displayed?
  • Does it seem like this error is occurring for every device or is it sporadic?

There is a known random glitch in the Edge platform when it comes to custom capability definitions, so I wonder if you might be seeing this issue.
EDIT: See this post. There is a coding workaround which I may need to implement.

Channel driver. I got 20 devices created (looks like my Denon devices generated 2-4 devices each). Going back through the logs, looks like its for every device. None of the devices display any values for the capabilities.

OK then, I’m pretty certain this is the known custom capability glitch which means I need to implement the workaround. I’ll post here when I have that updated. Sorry for the trouble, but thanks for reporting this.