Can I subscribe to SmartThings devices using the SmartThings API?

Hello,
I subscribe to a SmartThings device and want to be notified when changes are made to the device.

I checked the URL below, but didn’t find any information.

Also, there is a description of the ‘https://api.smartthings.com/v1/subscriptions’ API in the URL below, is this an available API?
403 on device subscriptions - #5 by Paul_M

Can someone help me with the SmartThings device subscription feature?

The subscriptions API can be used to notify a smartapp that events have occurred. In the documentation here it says:

Subscriptions API Basics

Subscriptions belong to a specific installed instance of a SmartApp. The Subscriptions API follows the path pattern of https://api.smartthings.com/installedapps/{installedAppId}/subscriptions.

Subscriptions are typically created or updated during the INSTALL and UPDATE lifecycles, when the user has selected devices and granted the requested access to your SmartApp.

When a subscribed-to event occurs, your SmartApp will receive a POST request containing information about the event, so your app can react accordingly. See Subscription Event Handling for more information.

So, you would need to host a smartapp of some sort that would receive a POST when an event occurs.

1 Like

Hi Yalu,

RE: Also, there is a description of the ‘https://api.smartthings.com/v1/subscriptions’ API in the URL below, is this an available API?
[403 on device subscriptions - #5 by Paul_M]

The API is a websocket API. It is a little different than a SmartApp, but very similar JSON. At the time of that post I was with a large company developing a homeautomation/entertainment application on Windows, integrating SmartThings. We had to register as a Partner I believe, and received from Samsung/SmartThings a document and the JSON protocol, to send changes, and receive changes to the ecosystem via the Websocket.

I am not sure if SmartThings supports this API any longer. But …

If it does, then it would depend upon your applications expected network topology as to whether you use the API described @h0ckeysk8er (SmartApp) or this WebSocket (No Server, SmartThings App) api.

I wish I had the link for you to sign up, I recall doing that, but can’t seem to find it.

If you do find it and need some help let me know.

Best of luck,

Paul

1 Like

Thank you for your answer.

I will check that API further. :smile:

Thank you for your answer.

I see. I’ll have to find another way then. :+1:

The only freely documented way of subscribing to events is to create a SmartApp, as has has been mentioned.

The Samsung Automation Studio, which is based on Node-RED, can subscribe to events without having to be plumbed in as a SmartApp (though you can do that). My understanding is that it uses Server-Sent Events (SSE) for this. As Samsung make their whatever-it-is-called freely available to other Node-RED users I have rather been presuming it works for them too, but I don’t know for sure. So SSE is certainly floating around, it just isn’t documented and access to it may be restricted somehow.

1 Like