Multiple Small SmartApps vs One Large SmartApp vs Rule Machine

I’m looking for advice from other developers on the recommended approach to SmartApps for very specific things. I’ve found that a lot of people have written great SmartApps, but they never fit my needs exactly.

Rule Machine appears flexible enough to do everything I need, but some simple tasks would require multiple complex rules. If I didn’t have a programming background this would probably be the best choice, but I think I’m better off writing something that’s easy to troubleshoot and easy to understand in several months from now when I go back to make changes.

After figuring out everything I want my house to do and how it could be implemented, I realized that if I used the existing apps or created new ones for each type of custom functionality, there would be a lot of overlapping preferences and subscriptions.

I’m starting to think I’d be better off writing one large SmartApp to handle all the custom things I want to do, but I have some questions/concerns:

  1. There will only be 1 or 2 things scheduled, but I’m not sure if I’ll run into problems with the execution limit, run duration limit, and/or schedule limit if multiple event handlers get called around the same time? For example, what would happen if the temperature changes and motion is detected on multiple devices at the same time that a schedule runs and I press a button that changes the mode and the mode change event causes something else to happen?

  2. Will a lot of Preferences cause problems? There would probably be at least 30 and most of them would be optional and a lot of them would be multiple.

  3. Will having a lot of lines of code cause problems?

Any advice, horror/success stories, or additional resources would be greatly appreciated.

As the author of Rule Machine, I have some perspective on this for you. Before implementing Rule Machine, I had a few custom apps that I wrote to solve specific automations in my house. Some, but not all of those have been converted to rules. I have a custom motion-lighting app that I have about 20 instances of. Each of those would take 4 or 5 rules to replace, so I continue to use that app. Purpose designed apps are generally pretty simple. One way to think of Rule Machine, is that it opens up all of these automations to non-coders.

As to your specific questions:

You are very unlikely to run into execution limits or any other limits if you aren’t doing some kind of looping. You can certainly have a dozen things firing around the same time without any issues. That’s not to say there won’t be any issues, just that those won’t arise from your code specifically, just ST issues that affect all apps (schedules get broken, scheduled events get dropped at peak load times, etc.).

Having lots of Preferences will not cause any problems. Just look at Rule Machine, it has dozens of Preferences. Having many lines of code is also not a problem. Rule Machine is pushing 2000 lines, Big Talker is over 3000 lines; all good. If you were to trace the execution path of an event through Rule Machine, each event only uses a small portion of the code; there are simply lots of variants.

So, I’d say, knock yourself out and implement exactly what you need. I would suggest that you might find Rule Machine is quick and easy for simple things. There is a point at which you’re reinventing the wheel, and there is a point where your wheel needs customization. Both are valid. Choice is good.

Have fun!! :grinning:


THAT! And I might add that it works when other ready-made apps fail. And based on Bruce’s due diligence and community contributions, saves time QAing custom code.

1 Like

[quote=“bravenel, post:2, topic:34723”]
There is a point at which you’re reinventing the wheel, and there is a point where your wheel needs customization. [/quote]
That’s a really good point so I’ll definitely take a closer look at Rule Machine and figure out which sections really need a custom app.

Thank you for your detailed response, you’ve been a huge help.

1 Like