[Released] Rule 4.0


I've converted all but one of my rules to Rule Machine from Webcore becuase of reliability issues... But webcore was so much better a gui... I wish hubitat would embrace it instead of shunning it...


We didn't shun it. But just about everybody using it early on had serious problems with it. Don't know about more recently. I suspect it has improved. One issue is that it was designed to run in a cloud resource rich environment, not on a small contained processor. I don't realistically see that there is any way we could embrace it, given that.

Feel free to give it a whirl.

Oh, and I happen to agree about the UI being better.


If there is one thing I have learned of RM (actually whole HE) is that you don't wanna use the browsers back button, ever. Since a lot of drop-down and other input field use the "auto submit form on change" way you would start something and abandon it half way. Fortunately HE remembers where you have left of. But unfortunately people tend to you the browsers back button to "cancel" their actions. This doesn't work like that. So you actually have to press a "cancel" button or something like it if you notice you're in the wrong section of RM. Also it took me a while to understand where you would end up after saving or hitting "done". But if you do it often enough you will notice there is a logic to it, maybe not the logic you would embrace every time, but for the most of times it is the logical page to end up on.


I played a little bit with 4.0 with no success. I will stick with 3.0 and hope 4.0 will be improved in the future.


I for one (of many) want to give Bruce a big pat on the back. The release of RM4 was a major step forward. Admittedly there is a learning curve. I trust there will be less bugs and improvements to the UI as Bruce advances this app. I would love to be able to copy and paste actions between rules, but RM isn't a programming language and so likely won't see that happening. The Cloning function is extremely helpful in making backup copies of rules, or to duplicate a rule to modify to another purpose. I think as the dust settles and we adapt to the new options in triggers and actions we will easily develop logical automations that are easy to follow and maintain. I appreciate the willingness of the Hubitat team to accept suggestions, answer seemingly endless questions and hold our hands through the learning process. Hubitat is an exciting product with a development team willing to allow customer feedback to help steer development. Bravo!


I do think Bruce has done a good job, and this is a powerful tool. I don't mean to crap on that at all.

What I do think is there needs to be some easier way to set things up. I can't even copy a rule that is shown on this board for some reason. That would seem to be a simple task to basically "copy" a known good rule, right?

Things like nested or multiple IF>THEN type statements and ENDIF and delays and repeats all make sense if I type them out in Word, (or write it out on paper) but in the UI it just isn't very intuitive for me.

Maybe there needs to be a "simple mode" or something? Maybe the way things are worded makes it confusing to me? Dunno. :confused: All I know is I wish it would click somehow. I sometimes feel like I am the only one that doesn't understand how this works. :disappointed: :exploding_head:


I feel with you @neonturbo. I was standing in your shoes a couple of weeks ago. And yet, I do understand a whole lot more about it now. What I did to get through this, is the following:

  1. I made a lot of virtual devices to test with. I came to a fast conclusion that the wife didn't like me learning on the devices she uses on a daily basis. :crazy_face:
  2. I wrote down some mayor rules I wanted to create on paper and split them up in separate workable little rules, still only on paper.
  3. I made the simplest rule (with if, then, end-if) and fooled around till I finally got how the UI actually works.
  4. I made the next rules one by one until I got the final end result I wanted.
  5. I merged some rules together and tested the outcome. And since I only use virtual devices I can simply test that. Also made a test dashboard with all virtual devices on it.
  6. Merged the final pieces again and had the final result.

This took me about 6 - 7 hours of fiddling around. Yes there were times I got frustrated. But in the end I got the hang of it. And although there are improvements possible to RM, you still want to get going at this moment. So we have to play with the cards we were given.

And though I never tried RM3, I must say that RM4 is very powerful. And I also know by now (talked a little with Bruce about it) that improvements are in the making, though the core of the system doesn't make it easy to change some things we might think of as easy changes.


Ohw and another question to everybody else: does anybody know a good tutorial screen grab of RM4 maybe? If none, maybe I could make one, though I'm not the most experienced. And I would have to find some time of course.


It's difficult to explain the issues faced in developing UI in this system. We "inherited" a UI functional definition through the decision we made at the outset to offer source code compatibility with SmartApps written for SmartThings. Rule Machine itself was originally such an app, offered as a community app. This UI functional definition is inherently limiting in what can be done easily. And, I should say, that the streamlining of the RM UI that has happened through Rule 3.0, and now 4.0, was by no means easy. I'd confess that this particular UI functional definition has been pushed to its limits, and you all feel that.

I just spent 20 minutes creating a weird little rule to average some luminance measurements every morning. I know how tricky the UI is to do right, and how easy it is to make mistakes. I wouldn't call it very friendly in that regard. It is powerful, but unfriendly. I think the first challenge was to bring the power and the streamlining from its past. Now, the forward going challenge to make it more friendly is going to entail a completely new level of UI functionality. This is not a small undertaking.

It's natural to be impatient with these things. I want it to be perfect NOW, dang it. Reality is somewhat different though. So, all I can do is urge you to follow @frits approach to take the time to learn how it works, and set aside your impatience. Relish the fact that it is capable, albeit not always easily, of doing pretty much any automation task you can dream up.


Bruce, I get that. Things need to start somewhere, and you are planning to improve things someday. But in the meantime, is there some way that would help us noobs out? I dunno, a flowchart or more explicit instructions or something? Again, I am not sure where my particular issue is, but I seem to get lost in the UI somehow and never able to recover. I end up deleting more rules than I complete because something gets screwed up, I get a weird error, or I cannot get back to where I started from somehow.

I can do very simple rules, If X turn on Y type thing, but that can also be done with Motion Lighting or other apps. I just want to figure out how to go beyond those capabilities. It is just so irritating when I KNOW a thing can do what I want, but I can't figure out how. It is like having Q, Z, and X in Scrabble with no U and no vowels. :smile: You know there is a play somewhere, but you keep drawing more awful consonants.


Ask for help here with whatever you are stuck on. Several people will respond quickly. Just describe what you want to do, and what you can't see how to do, post what you have....


Can an app define a global variable?

I'll answer that - nope.


I'm just getting my bearings here, but this is an effort to create a simple global color temperature variable that spans the CT range of the bulb throughout the day in order to take advantage of prestaging functionality. My LIFX bulbs range from 1500-6500, so the idea is it starts at 1500 at 5am, and steps up every 30mins at 6500 at 2pm, then steps down until 11pm and stays there until 5am again. I've done some testing with smaller numbers and higher frequency and the logs seem to show it's working correctly, but I'm not sure if I'm using END-REP correctly, because it shows up after each change to the variable.


I'm also unsure if it's better form to use ELSE-IF for multiple time periods, or close it and start a new IF for each segment. Any suggestions would be helpful, thank you.


Yes, this is to be expected. Just look at the actions: Repeat, Add, End-Rep.

This is actually the better way to do this. If the IF-THEN is true, then both ELSE-IFs are skipped. You would only start a new IF if it was independent from the prior IF. But in your case, it isn't, it is the alternative possible truth, so ELSE-IF is exactly right.


Are independent IFs handled sequentially? Does a first IF have to complete in order to proceed to the next, or are they handled in parallel? I'm reading through the entire thread and will probably find the answer.


Can you tell me where you got this answer? Because RM is nothing more then an app itself, so any other app should also be possible to create a global variable.


I would opine that "global Variable" is a construct wrapped around existing variable storage.

app.updateSetting("someName",[type: "bool", value: false])

can set an element of storage. But a "global Variable" is all about the ability to name it, define it (boolean, number, string, etc.) and less about the actual storage.

Can you write a Parent app and allow child apps of that parent to access a named variable? Sure. But you would also have to write the 'Create a Global Variable' portion too, if you needed to mimic RM's global Variables.

Can an app you write create a global Variable to be used in RM? No, your app isn't a child of RM. Apps are sandboxed.

All my opinion, of course.


So the "global variable" isn't system global only parent app "global". Makes sense as everything is sandboxed. But would it be possible to access a app variable in a tile (just curious, I know it's off-topic) and if not, would it be possible to create a driver for a virtual device only to hold a value to be used on a tile?


wait... can color temperature be set by a variable? it doesn’t seem like %variable% is accepted.


When I asked about displaying GVs on the dashboard I am pretty sure Bruce said that global variables only exist within RM itself. So no other app can access them as it stands.