Many VS One Smartapp?

I have several small Smartapps that I have written for my own use. They are unrelated to each other as to what they do.

I was wondering if it is better to have several small apps or to combine them into one app? Which is more efficient from an operating stand point?

Hi @Jwwhite

It depends on what they do and with what devices. Maybe you should tell us more about them, than we will chime in.

They are really not related to each other as far as devices. Although there is some duplication of devices in some of them.

For example, I have an app that runs my good night routine, turns off tv, turns on some lights. off some lights, etc. It also runs my good morning routine.

Another app controls the outside lights, motion, presence arrival, etc.

Another app controls my alarm system. I wrote my own as SHM didn’t really do all that I wanted.

And there are a few others.

I don’t know how ST executes smart apps and thus was wondering if they became more efficient if ST only had to execute a few vs many.

For apps you described, you can combine all of them into either WebCore or the ST native app Smart Lighing. They do most of my heavy lifting. Scratch that…WebCore can do the job of both.

I used to use WebCore, but it was too messy to do the things I wanted. I could write my own apps a lot easier and accomplish more. Smart Lighting is ok if all I wanted to do was turn lights on/off based on time or motion or such. My scenarios are more complicated than that.

For instance: I tell Echo ‘Good Night’. Echo sets a virtual switch which triggers a smart app routine. The routine turns the TV off, sets the alarm to night mode, turns on the kitchen light and bedroom light, turns off all but 1 of the living room lights. The living room is between the kitchen and bedroom. So one of us goes into the kitchen, gets the coffee ready, etc. When leaving the kitchen we turn the light off with the wall switch. Then 10 seconds later the last living room light goes off which allows us time to navigate the living room to the bedroom. I tried this in WebCore and it would work maybe half the time. Since I wrote a smartapp to do this it has worked flawlessly ever since.

In any case, none of that answers my question as to how ST executes smartapps and whether it is more efficient for many or just one. I can combine several of mine into one long one if it would be more efficient. That is all I’m asking.

My thoughts are that I use WebCore for all the cases you described. You can have multiple Pistons and even have one Piston call another Piston. You can also get @JDRoberts if he can donate his thoughts. He has helped me before.

Yes I know I could use WebCore and call one piston from another, etc. At one time I had about 50 WebCore pistons. But for a number of reasons I found it a lot easier to change over and write my own Smart app.

But whatever, I was just wondering how ST executed apps. It doesn’t really matter, it’s not that big a deal.

It is likely more efficient to have “many” SmartApps. Easier to debug, faster to compile, and easier to optimize.

We don’t know all the details of the SmartThings Cloud architecture, but even though there is multi-instantiation of a single SmartApp, there are a few areas of possible lock contention.

But the “parent-child” approach is a compromise. Smart Lighting is the best example of a “well written” multi-purpose (but well-scoped) SmartApp … unfortunately, the source code is not open.


Thank you. That was sorta my thoughts. I didn’t know if ST was using an interperter or compiling the smart apps or how they executed them. I would assume there is some ‘operating system’ that is either scanning the apps or setting up interrupts based on what is subscribed to or whatever.

Another advantage to me using my own, or even someone elses smartapps, is the easy ability to change a device used in the app. Just the other day my wife said it would be better to have a different light come on in a scenario. All I had to do was open my phone app, change the device, hit save. In WebCore I would have had to open a browser, edit the piston, etc.

By the way Terry, please don’t let anything happen to Actiontiles. That is my most useful thing I use. Especially for my wife.


Shucks, and thanks (and passing your appreciation to @625alex too!).

Sales growth and appreciation of our Customers are all the incentives we need to keep working and advocating.

If you haven’t already, please feel encouraged to share your compliments as a valuable endorsement in the form of a Rating & Review on Facebook Reviews tab (Facebook prevents manipulation of Reviews!):


From time to time we’ve been given more details of bits and pieces of the architecture, but the platform is surely changing too, so we’ll never know everything.

SmartApp code “obviously” contains metadata, so it cannot just be converted by Java-bytecode and thrown into a VM - At the very least, it has to go through a pre-processor.

There is likely entire abstraction layer(s) of various sorts. We’ve been told, for example, that one JavaVM can run multiple SmartApps concurrently from different Accounts. For this to be secure, developers obviously can’t push “arbitrary” Groovy or Java. Only certain libraries are permitted, and we can’t create global variables or global objects / methods, and so on.

But a lot of this changes in the new API, where SmartApps are just a data structure, event director, and scheduler. All executable code (and processing of it) will be the responsibility of the developer… i.e., run in their own AWS environment or other server. SmartThings will no longer accept new Groovy-based SmartApps.

I used to do a lot of programming back about 30 to 40 years ago. Mostly Basic and C++. But my career ended up going the PLC route and that is all I did since then. Now that I’m retired, or mostly retired, I like to play around with this stuff as a hobby. My biggest problem is learning the language. I know the principles of programming, but not the new language. So it’s been both a challenge and fun playing around with it.

I tried writing a simple app using the new API, but didn’t get very far. The app would load and go so far, then just seem to quit. I wrote that off as ST not quite having everything ready. Will wait before trying again. I hope they, or someone, comes up with a basic outline like they have for a groovy app. With sorta fill in the blanks type of thing. Makes the learning curve for someone like me a lot easier.

For some reason I didn’t realize you had a facebook page. I’ll certainly leave a review.


Yah… ActionTiles is nearly everywhere as “ActionTiles”: Facebook, Twitter, Pinterest, Instagram, Google+, YouTube, Houzz, … Tinder :laughing: :, … but we haven’t figured out which channels to be active on. Cya out there!

1 Like