[UPDATED] Rule Machine with Triggers

Unfortunately, I blew the time-of-day setup for old Rules, and there isn’t anything I can do now to fix it. A mistake. But, if you just re-enter the times, it will work fine.

1 Like

Yeah this worked ok :smile:

It sure is! @bravenel how many hours have you logged developing this app? I ask because this app literally can take care of 90% of everyone’s smartapp needs and I am trying to figure out why it took a non-paid community developer to build this and Smartthings didn’t create this app themselves from the get-go.


I’m sorry, I guess I wasn’t understanding the term “race condition”. I understand now.

I started on it on November 1st, had most of the original done after a couple of long days. Left town for a week, and then released it on November 11. I actually completely rewrote the rule evaluator that morning, and haven’t touched it since. Since then,I’ve been adding features, adding triggers, integrating triggers, etc. My guesstimate would be maybe 70 to 80 hours invested, not sure. I can say for certain that well over half the effort is fussing with the UI. My wife thinks it’s all I do. :grinning:

Why ST didn’t do this is pretty obvious: They thought a concept like this was too complex, and tried to shoot for a more basic customer, who needed simple little automations and a simple UI. I think they got caught in design-by-committee, which I don’t suffer from. Smart Lighting doesn’t need a long write-up of explanation as Rule Machine does. Plus, I think people who are using Rule Machine are not typical ST users, but are more capable than most, and are able to think logically.

The most telling difference to me is that they have bugs in the IDE, in Smart Lighting, and the mobile apps that have been there for months, not addressed. When someone reports a bug in Rule Machine, I usually have it fixed within an hour (unless I’m playing golf or sleeping). But, in their defense, they have probably 2 orders of magnitude more code and more complexity than I’m dealing with. Still, how hard can it be to get a dimmer to turn on to the selected level from motion? How hard can it be to find and fix that bug?


I was privy to a small bit of info about SmartThings when I was still at Samsung (left 6 months ago). I’d say this assessment by @bravenel is spot on. There’s really nothing wrong with designing for a broader range of customers (probably a lot of friends and family of those of us most active in debugging this with Bruce), however, I’d really like to see @Ben and @slagle advocate with ST management to allow advanced users such as us to run Rule Machine locally.

Not only would this help in a lot of the performance issues we’re seeing, it would help stoke the excitement of those of us who are ambassadors for this platform to both technical and non-technical associates. Right now, I don’t feel comfortable recommending ST to anyone but my most technical family/friends. This is mostly because of the limitations/bugs in basic platform features. I know ST is working hard to fix these things, but I think having Rule Machine locally run would also help flush out even more of these basic platform issues to allow ST to try to fix them and improve overall system reliability and stability for all classes of users.


For those in favor say AYE now!!!


I agree completely. But, they still could have tucked Rule Machine into a corner somewhere under “Advanced Apps” or something. Then they would know how many people used which apps for what. Instead, they left the platform somewhat crippled by simplistic apps. That caused the community to step into the gap to fill needs “simple” just didn’t get to. Rule Machine is the, ahem, logical outgrowth of filling that gap ST left unaddressed. :grinning:


Boy howdy! This really seems like it should be a no-brainer for ST. By allowing it to run locally they would relieve pressure on the cloud while simultaneously providing an upgrade incentive for v2. Heck, the author of Rule Machine is still on a v1 hub, as am I. You can bet I would be ordering a v2 though if Rule Machine could run locally. Currently, v2 has nothing to offer me, since USB and BT do nothing, there’s very limited local execution, and I already have all my equipment powered from a UPS.

1 Like

If this goes local then I’m getting the V2 :slight_smile:


I have a weird issue with Rule Machine:

I added a rule, but after defining triggers, it gave an error with a red bar across the top indicating I wasn’t authorized to make that change. It went away, but then I couldn’t select any actions. I tapped “Done” and it created the rule (without an action).

Now, I have an incomplete rule, but I can no longer access the rule. I tap the rule under “Rules and Triggers,” but it just gives a spinning circle that it’s trying to think, but I can not access the rule. I’m now stuck with an incomplete rule I can’t delete. Any advice?

Edit: Here’s the log entries:
210a62a6-2aea-41e1-9c83-8f18d6ac3c20 1:07:22 PM: trace getPhrases(), state.welcomeIssue = null
2f6af7b5-2f77-43d7-bc14-daa6f6c66b04 1:07:22 PM: error java.lang.NullPointerException: Cannot get property ‘value’ on null object @ line 1087

Sorry for your difficulty!

You should be able to delete that rule from the IDE. My Locations / List SmartApps / Edit (upper right corner), then find the culprit under Rule Machine and uninstall.

I will look into this further…

Thanks! I’ll report if it happens again.

I think there is a lack of robustness in Rule Machine when it comes to malformed rules, and backing out of things that are incomplete. It wants to show you what you entered on the main page, and evidently can step on a crack. This is very difficult to track down, because there isn’t enough evidence to go on.

If it does happen again, please try to take screenshots of whatever you can, like right as soon as it throws the error.

1 Like

I just pushed a 1 line update that should protect against this failure. There was only 1 variable unguarded in that code, but it’s not unguarded now!


@bravenel I have a rule that is setup to automatically lock my doors after they have been unlocked after 5 minute. However, I am noticing in the logs:

c2fa6ba2-3001-4da8-927d-3ea047eb081e 3:38:45 PM: error java.lang.NullPointerException: Cannot invoke method getAt() on null object @ line 1092
c2fa6ba2-3001-4da8-927d-3ea047eb081e 3:33:45 PM: info Delayed by 5 minutes
c2fa6ba2-3001-4da8-927d-3ea047eb081e 3:33:45 PM: info Automatically Lock The Doors!: Front Door Lock lock unlocked

Never mind @bravenel. That was an old trigger that carried over before you combined apps. I delete that rule and re-created and now it’s working.

I would appreciate any help from the community.

I have a motion detector that turns lights on with motion - I use a Smart Lighting switch for this. However, when a particular person is present, I want to be able to disable that motion detector turning on a light.

Is there any way to do this with the Rules Machine? Or any other way to have a motion detector only not turn on lights when a particular person is present (and when that person is not present, the motion detector still turns on the lights).


This could be done in Rule Machine. Give it a spin :slight_smile:

Thanks - but that answer doesn’t really help. My question was how to do it in Rules Machine if that is possible at all.