Hello!
I made smartapps using SDKs to record the measured values by my sensors
the problem is that I noticed that some capabilites are not subscribed.
also, when the not-subscribed-capabilites are selected alone, they work well.
I reviewed my code and found that not-subscribed-capabilites are located in lower part of code.
So i doubted there is maximum allowed number of Handler(or Subscription) in smartapps.
for my case maximum number seems 7.
Welcome to the SmartThings Community, @hyungmin!
Here’s the info about Subscription limits in SmartApps:
It’s 20 subscriptions per installed app.
Can you describe what you mean by “not-subscribed-capabilites”?
There are other subscription types, for example, to avoid creating one per device, you can create a Capability subscription which would help you get the events of every device in your location that uses it.
In the API reference, you can see the scopes needed for each type of subscription, and this is the function in the Core SDK.
Also, you can check if the subscriptions were created by making a request to the API:
As an additional note, is this SmartApp for personal use? Remember that up to now, they cannot be published in the ST app catalog, each user would have to register it in their Developer Workspace.
Hi naylyz
thank you for answer and kind suggestions !
“not-subscribed-capabilites” was unclear words
that meant subscriptions those were unavailble due to limitation.
It is little confusing that we have both options that subscribes device or capability,
since “subscribeToDevices” also use capability as parameter rather than deviceId
by the way, capability subscription looks more extensive and useful for my case
I will try that way soon, and will fix the codes as your suggestion
Thank you !
Just as a reference, it takes both the device selected in the “page setting” and the capability name as parameters, for example:
context.api.subscriptions.subscribeToDevices(context.config.light, 'switch', 'switch.on', 'onDeviceEventHandler')
//For the subscription to work we must have set a setting with the ID "light":
section.deviceSetting('light').capabilities(['switch']).required(true)
Then, this function gets the corresponding info from the config entry.
Thanks for all comment
I changed SmartApp code to use “subscribeToCapability”
For anyone who wanna try this,
you should remind that you need permission configuration to subscribe to capability.
otherwise SmarApp won’t make subscription and you will see 403 forbidden error when create subscription via API