Multiple devices causes error in SmartApp Automation

I am working on a SmartApp using NodeJS and it works fine until I start adding lots of devices. After I have selected all of my switches, and I tap Done to authorize them, I get one of two errors:

  1. A blank page that says “Failure: 400 Bad Request”
  2. “Unexpected error occurred!”

I am working to move my more complex automations aware from WebCore and using my own hosting to do that. I believe I have the functionality but it seems like there is an issue when I try to use a large number of devices. Is there some limit to the number of devices an automation can use?

Thank you,

Hi, @jwerfel!

Sorry for the delay.

Could you explain the functionality of the WebCore piston you’re trying to migrate, please? Perhaps there’s another alternative.

This automation was to replace a WebCore piston I wrote that would check my contact sensors, motion sensors, locks and moisture sensors to make sure everything was in a good status and then send a notification. I used it when leaving to check if the house is ready to go. I could write a routine that checks various devices but in using the automation I can provide a message indicating the device that is not in a good state (such as an unlocked door).

Originally my automation would also check to make sure lights were turned off and this is where I ran into trouble. When my automation had a large number of devices (more than 40 or so), the configuration would not work. I was able to create two instances of my automation and split the devices, but that is not optimal.

For now I’ve removed the switches from the check and it works as expected.

I would like to create more automations but if there is a limitation to the number of devices it can use that could be a problem going forward.

Thank you,

Same problem here.
With groovy you can subscribe to infinite devices, with the new SmartApps there is a very low limit of 20!
That does not makes any sense.
I use more than 20 devices for my own home alarm system…

Can you describe your use case? Would it be possible to use the Rules API instead? This would include not using notifications.
I’ll ask the team for more details about this limit, however, changing this would take some time to be reviewed.
I think so far, using more SmartApp instances is the right workaround.

The example is: I would like to create a smartapp of an advanced home security alarm
I need to subscribe more than 20 devices, but I cannot because there’s a limit in the number of subcriptions.
Or also: I would like to activate the SmartThings NodeRED palette, but when I choose more than 20 devices to connect (in order to receive webhooks and update the states), I get the two errors already described in the first post:

  1. A blank page that says “Failure: 400 Bad Request”
  2. “Unexpected error occurred!”

See the screenshots:

IMAGE 2022-09-26 20:35:11

There is a limit of 20 subscriptions, yes, but you can subscribe at the capability level.

By contrast the poster earlier in the thread didn’t seem to need any subscriptions at all.

Can you explain what subscribing at the capability level means?

My original problem is I wrote a SmartApp that checks X devices to make sure they are in a specific status (doors locked, windows closed, water sensors dry, etc) and then notifies me of any issues or a message saying everything is good. My Smart App is currently working with 29 devices selected so it is more than 20 but I know if I pick too many (I don’t know the actual number) it will show the errors shown above.

Originally my Smart App turned lights off too but that put me way over the top so I stopped doing that. The frustration for me was a magic number I didn’t know about limiting the functionality of what I could do in a SmartApp.

Thank you,

Yes, but Subscriptions | SmartThings Developers probably does it better than I would.

The above suggests there are two types of subscriptions. That isn’t quite true. There are at least eight. API | SmartThings Developers