[UPDATED] Rule Machine with Triggers

Hi Bruce - great great great app! Thank you!!
I ran into a problem on the new version: I kept getting a “not authorized” error however I was allowed to save the rule and it is functional. (Trigger: Button push turns on light). The problem is that I cannot get back into the rule to edit it. I wanted to set up for a button push to toggle the light and holding the button will dim to 50%.

Any ideas for getting into the rule so I can edit it - or even delete it and start over? I have ~15 rules set up already, I’d rather not start from scratch.

thanks to you and to all in the community!

Don’t know what that’s about. Sorry.

Go into the IDE and see if you can delete the one rule. My Locations / List SmartApps / Edit (upper right corner), then find the rule in question, and hit uninstall. There is some chance that will throw an error. If you could report back, I’d appreciate it.

Forgot to mention - I found this in the live logging.

0fbdec6b-29f8-4295-a85f-ed66eb0632ab 5:59:46 PM CST: error java.lang.NullPointerException: Cannot get property ‘value’ on null object @ line 448
0fbdec6b-29f8-4295-a85f-ed66eb0632ab 5:59:24 PM CST: error java.lang.NullPointerException: Cannot get property ‘value’ on null object @ line 448

I was able to delete the rule using the method you described.

Thank you for the quick reply!

Thanks for the line reference. I found a bug and fixed it. Pushed update.

1 Like

I am still having the issues with the rule with the two rules inside. I took some screen shots, if there is any sort of log I can pull let me know:



As you can see, they both individually say false which is correct, but when brought into a rule together as conditions, one changes to true.

You have this problem, as described in the documentation:

Caution: Rules that use multiple rule-truths as conditions can fail due to race conditions should those tied-to Rules change state simultaneously. Best practice would be to avoid using multiple rule-truth conditions in a single Rule. Triggers do not have this issue; multiple rule-truth events in a Trigger are treated such that any of the Rules proving true/false (as selected) causes the Trigger to take action.

By definition, you will hit this problem whenever you have two rules as conditions, because Rule Machine evaluates the rule when you hit Done. That means those two are simultaneously evaluated, and that is not going to work!

just wanted to add a note this - I’ve just updated to the latest github version. After I noticed that non of my timed events were working.

Checked all my rules (10 of them) and non had a time condition set was listed as “null” when there was a set time before.

Not sure if this helps in figuring anything out?

This happened when I upgraded also but just went back in and re-added them since I didn’t have very many rules.

1 Like

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.

7 Likes

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?

8 Likes

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.

6 Likes

For those in favor say AYE now!!!

2 Likes

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:

6 Likes

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:

2 Likes

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…