Help with webcore to rulemachine migration

I've been digging around trying to find something I can wrap my head around with rule machine. Some things ... I get. Others, I'm still on the webcore mentality. I have a few pistons that should be easy enough to move over. So, if anyone would be willing to educate me on the use of the advanced pistons, I'd be much appreciative. I want to understand the different categories. when they should be used, the advanced options. The manual is fine, but I kind've need examples. Is there a video out there or examples that I can refer to?

1 Like

So I've always hesitated to try to help with these gerneral RM tutorial questions because I feel like there is still so much for me to learn. I've had many AHA moments that open a new level of understanding. This thing is layered and very different thinking that webCore. I (and many others here) have struggled making the switch so I'm going to give you "RM - According to Stephan". Keep in mind, this was how I was able to wrap my head around RM and there are probably holes in my logic. But anyway here goes...and also keep in mind that this is very general. More complex rules may require a combination of these.

  • Condition - state of any given device/capability...eg switch ON. motion Active, etc

  • Rule - used to evaluate whether a condition (or set of conditions) is TRUE or FALSE... eg Is switch on? , is motion active?

  • Trigger - executes when a device changes state...switch is turned on, motion becomes active.

  • Action - The action is simply what you want to accomplish after everything is evlauated or triggered. It can be one event every time or different events depending on the rule truth(rule=true or rule=false).

3 types of Rules:

  • Rule: If this, then that, else logic (2 potential set of actions can be executed depending whether the IF evaluates true or false)

  • Trigger - When this happens, do this (only one set of actions are executed)

  • Triggered Rule - When this happens (Trigger section), process IFTTT logic (Define Rule section) and then excute the appropriate set of actions (Actions Section).

The Select Conditions section - This can be particularly confusing. You simply enter all the conditions you will be evaluating in the the Define Rules section. It doesn't actually do anything. It just lets you select all the various states you want to evaluate. The Define Rule section uses what you chose here to do the actual evaluation.

The Define Rule section - is always monitoring the states of the selected conditions and is always in a TRUE mode or FALSE mode and only executes the appropriate action when the rule truth CHANGES. If the rule truth CHANGES to TRUE then the Actions For True will execute...and the same applies for False.

3 Likes

It's too bad that there's not a way to share a full example of rules in one shot. There's so many hidden things in the app that it's difficult to know what any one thing is going to do. That has made me stick to simple rules. I think I get what you're saying, though.

Good breakdown Stephan. I'll add to that IFTTT analogy for the triggered rule, is that it's a more capable IFTTT in as much as, IF THIS happens and the specified condition is met, THEN THAT should happen, but also IF THIS happens and the specified condition is not met, THEN THIS other thing should happen.

What I've seen @bravenel most often point out is that RM is like lego blocks and I really like that analogy. They simply do one thing and then the next, and you build upon them to create the structure you need. That can sometimes require one rule linking to another by various means. Virtual switches, Custom Commands or even one rule action calling another rule directly. I don't know webCoRE at all, but from what I've seen and read, it is a much more advanced way of scripting with logic that simple does not exist in RM. That's not to say it's better, because over here, it isn't due to the speed and other issues that can arise from its use. So keeping in mind the simplicity of RM will be the most beneficial to understanding the logic in the flow of things.

Having said all that, there are some pretty advanced flows @bravenel can come up with, and at the same time, can astound you with how simple he can show you how to make a rule that does exactly what you need. Most everyone here is willing to help and I'm not suggesting only ask Bruce for every rule you need help with, especially since he's noted that he doesn't know webCoRE either.

The simplest way to get help with a rule is to exactly describe for everyone the use case, what you want to happen and the factors you want to influence the conditions. That's a lot easier to help you get exactly what you need, rather than trying to figure it out from looking at a piston or RM rule. :wink:

2 Likes

Based on my first post ....here's how I go about processing how to build a Rule

TRIGGER:
"WHEN this DO this" scenarios.

Eg. WHEN motion BECOMES active then a) turn on light b) wait 2 minutes turn off light.
There is no stopping a trigger once executed. Even if motion is activated again. The light will shut off 2 minutes after the first active motion event. You cannot cancel the scheduled action because there is no evaluation happening.
If you select multiple events, the trigger will execute when ANY of them happen. Again no evaluation of anything.

RULE:
"IF this THEN that, ELSE this" scenarios

Eg. IF motion IS active, THEN a) turn on light ELSE a) wait 2 minutes and turn off light.

In this scenario, because the Rule is monitoring the state of the rule truth (motion active true or false), you can potentially cancel a scheduled action. You can now also use:

IF motion IS active
THEN(rule truth=TRUE) turn lights on
ELSE(rule truth=FASLE) wait 2 minutes and turn off the lights
CANCEL on truth change(only scheduled events) ie. if within the 2 minute window motion is activated again(rule truth changed to TRUE once more)

TRIGGERED RULE (The hybrid):
WHEN this,
First evaluate these condtions,
THEN if true DO this / If false DO this

Like Triggers, any scheduled actions cannot be cancelled. Trigger pulled no turning back, only question is which direction to shoot in.

3 Likes

Ah mah gosh. Ok ... so try and help me out with this rule then.
"things"
contact sensor
light switch

Purpose:
I want to open the patio door to let the dogs out. I have 2. When the door opens I want the switch to turn on. Close the door - the switch stays on. Open the door again to let them in and close it, the switch turns off. and waits for it to happen again. It doesn't need to cancel for any reason.
so open->On->close->do nothing->open->do nothing->close->off essentiall

I have struggled with this task even with webcore. I have an inefficient piston running it right now that's completely wrong, but it works. I'd like to get it over into rule machine.

So basically, you want it to turn the light on every other time the door opens..and turn off every other time it closes...correct?

1 Like

Yes but only between sunset and sunrise -60 +60 offset

You can do this part with Restrictions..at the very bottom of the rule page. Make sure everything is working as you want before applying restrictions.

So this one was tricky but I think I have something for you. You will need to create a Virtual Dimmer. The one I created is called Patio Light Toggle in the image below. It is essentially using the level value on the dimmer as a way to keep count of how many times something happens and then reset as needed. Make sure you turn the dimmer on and set a value of 1 inititally and of course, replace Front Door with you Patio Door contact sensor.

Edit: updated pic...chose wrong one before

2 Likes

Ok let me see if I can come close to this.

Let me just say that there is NO WAY I would have ever. In a million years. Thought of that. My way of thinking just isn't in that direction. Kind've makes me feel a little sunk. I hope I have a few aha moments with this. Thanks for the help. It's exactly what I need.

1 Like

Trust me...I didn't get here overnight...I got a LOT of help at first. Most of what I learned was from trying to help others and reading the solutions from others in the community. When it clicks, the learning process happens a lot faster.

There's probably a much simpler way to do this. @bravenel usually jumps in and says "why didn't you just do this" and then another aha moment happens.

2 Likes

That's reassuring. I'm working on another rule. I think it's just gaining an understanding of what each group can do for you. There's nothing in writing that can make you understand it. You just have to experience the result, I guess.

Take a look at the initial posts that describes what kind of rule does what. Then pick one. If you get stuck. Try another. You may not get it right but I'm sure you'll learn something new with each failure. I still start making rules only to realize after 20 minutes, that I should be using a different type. Most times you dont really know where you want to go logically till you start trying. In other words...dont overthink it. Just jump in and the rule kind comes to you...just dont get frustrated. Drop a screenshot of where you're stuck and someone will get you sorted...most times.

2 Likes

I've created a couple of mode rules. We're headed out the door to do errands. they're away and home rules. I'll see what bugs I've created. ha! Thanks again for your help. I'll be posting in the near future.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.