I want to edit a faulty line (ELSE-IF) in a rule. So I get:
Editing: ELSE-IF (Variable LichtSelektor(SpotAll) 'SpotAll'(T) [TRUE]) THEN
Now the only select option is "delete". So I get:
Editing: ELSE-IF () THEN
Now the only select options are AND, OR or XOR (and not "new condition"). When I move on, I run into problems. So after several forced steps, I get an undesired rule line. After all, I had to delete the line and to insert a new line.
Is this the only method to change a ELSE-IF statement in RM, or am I doing something wrong?
No, the issue is the missing "=" in the else-if condition.
I want either to add the "=" or to delete the condition expression "Variable LichtSelektor(SpotAll) 'SpotAll'" and to exchange it for "Variable LichtSelektor(SpotAll) = 'SpotAll'".
I think what you are trying to do is to manage the condition. To do this, when editing the rule action, you will see a box titled “Manage Conditions”.
Click on that box and you will see an option to edit your condition. You will be able to add the “=“ sign in that screen.
This is a bit confusing at first, I think it took me several months before I really understood how to do this…
Please add screenshots if you try and it doesn’t work for you.
Wow, I see!
Now I understand the purpose of the "manage conditions" box. Till now, I can't do anything with this box. I considered superficially any expressions, mainly not belonging to the actual actions.
A time-saving option!
I'm also having real difficulties editing/creating ELSEIF statements. When I create the ELSEIF I can't figure out what I'm doing wrong, but I don't see a place for me to actually tell it what the ELSEIF does. I always somehow getting back to where the statements are listed and I can't figure out how to get to where the action should be entered. I end up, time after time, creating the action, then copying it to the ELSEIF and then deleting it.
I read through the page at: Rule-5.0 - Hubitat Documentation
But that was too obtuse and didn't include the ElseIf (for some reason I'm not having the same problem with just If-Else-End If).
I looked for YouTube Videos but couldn't find easily find one showing creating and ElseIf (Maybe it should be the same as just an Else, but for some reason I'm not having the same problem with just Else conditions).
The Rule editor has an insert before, but what I want is to be able to click on one of the lines (like the ElseIf line) and then edit it from there. That is, I wish the parts came up as links so that clicking on one would take you into its edit mode. The Edit drop down just didn't work. I tried over and over to edit the ElseIf part but it seemed all I could do there was add extra conditions like AND, NOT, etc. I just can't figure out where to go to either while creating an ElseIf or trying to edit one that doesn't have any actions in it, to add an action.
Like I said, I finally got it working by adding an action and then copy/pasting it in, but I know there is a way to do it right and I'd like to learn it. I think a big problem is the naming conventions.
A few screen shots or point me to an ElseIf YouTube video would be much appreciated.
BTW, I don't mean to be all too whinny because I can't figure it out, it's just frustrating because when I finally do get it all put together it can be fantastic. What I did today is to create multiple If ElseIf rules for my Fibaro KeyFob and Aeotec Quad button controllers to cycle between Off, Low, Medium, High and then back to Off on my ceiling fans.
In the “Select Actions to Run” screen of Rule Machine, there are 3 sections:
Section 1 is where your built rule is shown. It is a view only area on the top.
Section 2 is full of drop downs and is where you actually build and edit the rule.
Section 3 is where you can see the the If, else-if or “Wait for Condition” conditions. Clicking on that gray box will allow editing of those conditions.
I think the problem you are experiencing is that you are trying to edit your condition in section 2. You can create a new if, else-if or “wait for condition” condition in section 2, but in order to edit it, you need to work in section 3.
Hopefully, yes. Somehow when I tried going into Section 3 I ended up making duplicate conditions. Oh well. I'll keep at it.
BTW, am I right that that we can't have AND triggers? In the video example it would seem like the trigger was It was 9 pm AND the temperature was >= 76 degrees. I tried to do it as multiple triggers vs 1 trigger and then adding the other trigger as a condition to the action, but it created an OR trigger (i.e. it was 9 pm OR > 76 degrees).
If I'm right that there are only OR triggers, I would like to add AND triggers to the wish list. It would have made creating the rule much easier and straightforward.
This is not possible. Triggers are events, like a switch turning on. They do not have truth values (like "is the switch on?"). The latter is the role of conditions, which can be used in conditional actions, required expressions, wait for conditions, repeat while, and other places in your actions. (There is a slight addition to this in the latest versions of Rule, where "stays" triggers, a.k.a. "sticky triggers," allow you to make sure the state resulting from the event remains true for a certain period of time before the trigger actually triggers, for triggers where this makes sense, but the above is still generally true.)
Required expressions, new in Rule 5.0 (previously called predicate conditions and predicate rules), can also help with some of these cases. With a required expression, the expression must be true at the moment of triggering in order for the trigger event to count as a trigger.
I believe that it might be clearer to those having difficulty understanding the triggering logic/mechanism if the explanation was stated as “trigger events are discarded unless the required expression is true.”
Such an explanation also answers the question of whether events are queued while the required expression is false (they are not).
That does sound clearer to me. I might think of a way to re-phrase it since if the required expression becomes false after the rule is created, the trigger event subscription is normally not there at all, so there's nothing to "discard," but...implementation details...
First off I just want to try to assure you that I’m not trying to pick a fight, but to make suggestions that would help simplify us creating complex rules. For years I’ve been reading over and over in reviews and in these forums how wonderful Hubitat is except the UI is convoluted and needs a major overhaul. So please take it in that spirit.
I'll try looking at Required Expressions to see if I can create an AND trigger. But as to how you describe triggers this seems to be a syntax distinction without a difference. Turning a switch on sure seems to me to be the same thing as asking is the switch on? that is, the trigger is: If the switch is on then…. Another example is Hubitat’s YouTube I referenced where the trigger was 9 pm. Again, I fail to see the difference between that and phrasing it as: If it is 9 pm then…
In any event, we can have multiple triggers. Back to the YouTube video, I was able to make the trigger 9 pm OR >= 76 degrees, (As the page stated after I created the 2 triggers: Any are true), so I don’t see why it couldn’t be made to allow us to make the trigger 9 pm AND 76 degrees, i.e. ALL are true.
My whole point is that we think in terms of multiple AND triggers, just like in the video Hubitat posted: e.g. it is 9 pm or later AND the temperature in the room is >= 76 degrees, so it would be beneficial to be allowed to create triggers like that.
there are some pages I got into trying to use Rule Machine that didn’t have a cancel button. (Sorry that I can’t tell you exactly where just now - and we are repeatedly warned to not use the browser’s back button). So please have a Cancel button virtually everywhere.
sometimes a Done button (or the next step we are to take) doesn’t appear until after we click off entering a value, so at first it seems like there is no Done button. My suggestion is to have the Done button in place, just disabled until we enter a value. That lets the user know there will be a Done button.
and along those lines
somehow make it clear with a Tooltip or something that we have to click off a field to make the Done button (or next step) appear (or as I suggest, enabled).
I’m just guessing this is necessary as the language it is written in only has an OnExit event and not an OnChange event which means you can’t have the Done button appear or become enabled until the user exits the field vs having made a choice or filled in the field, but while still in the field.
But that leaves me confused a lot about what to do next (especially when a Done button or next step isn’t visible until I click off the field I’m in). So, again, that just reinforces my 2nd point of why I would like to see the Done button, etc., on screen, but disabled.
And triggers isn't a thing. The triggers happen, but unless they happen together at the exact microsecond you can't get an AND. They aren't voting on their state here, and there is no logic in the trigger part of the rule.
The AND part happens in the actions. So you get this (not real inputs in Rule Machine, simplified a bit for discussion purposes.)
Triggers:
Light switch OFF
Motion Active
Actions:
If Light switch is OFF and Motion Active THEN turn on hallway light.
Thank you for the response. The AND part for triggers is just a wish list kind of thing. If it can't be, it can't be. The other side of the it is what it is coin.