Hoping to get some guidance. I have successfully connected to and been able to control devices using the SmartThings API. I know I can use the API to get the current state of the device, but does SmartThings offer a push event service that will send me an event/message when the device state has changed?
For example, when a TV is turned on. Instead of me hitting the API every second to get the state. Can I configure SmartThings to send me a push event through a webhook, mqtt or other method?
Thanks Bruce. This is were I was already going down and I created a webhook to my server and performed the validation steps. However I don’t see any traffic coming to the webhook after the validation step, so I am assuming that I need to somehow register the device(s) that I want to be informed about…
To validate which subscriptions were created by your SmartApp (and their configuration), you can call the endpoint https://api.smartthings.com/v1/installedapps/{installedAppId}/subscriptions using the installedAppId that you can see in the logs of your SmartApp. Also, the token for the request’s authorization can be the current one of the SmartApp (included in the logs) or your Personal Access Token.
Remember there’s a limit of 20 subscriptions per installed app so, if you want to receive the notification of events of more than 20 devices for the same capability, you can use a capability subscription instead.