RM4 and Java error

@bravenel,

Thoughts on what is causing this error?

Here is the rule

The reason I found it was, I wasn't getting any logging even though it's all turned on so I went into the rule and selected run actions, this is what then showed in the log

Rick

You have a malformed rule: you have an ELSE and END-IF with no IF, which is required for either of those to be valid. Did you mean to have an "IF Pops or Nana is present THEN" as the first action in your rule?

1 Like

Frick, been back and forth on that. Thought I read that the If wasn't necessary since the trigger was the, well trigger... I'm sure I just screwed up, I'll add it back in

Rick

An IF isn't necessary in any rule. You only need one if you want to use a conditional to run some actions sometimes and other actions other times, which you do. But note that your actions will, per your trigger, only run when one of the sensors arrives. If you want the ELSE to be meaningful, you'll probably want to change your triggers to "changed" and consider making two separate rules (one per sensor), otherwise you don't have a way to tell in the IF whether one sensor stayed home and another departed or whether both were away and one came back, for example.

Thanks bert...

I ended up going even simpler (based on a previous suggestion), it serves my purpose and a quick test of 15 second delay shows it working

Rick

That works! It won't cancel the opening of the door if you leave again, but it's definitely simpler. (You could use "Cancel timed actions" from another rule where either departs as a quick fix for that if it's a problem, but then I guess you're back to two rules. I guess your original rule only delayed the closing anyway...)

How would you structure this Rule to cancel if we left/returned...? I'm OK with 2 rules for this

Rick

I had a simlar error when I added an extra END-IF before an ELSE . No problem, but I can't edit the rule to remove it - when I go to edit actions, that's when I get the java no such element error. I wouldn't think this is desired...