[2.3.3.140 C7] Possibly Corrupted RM 5.1 Rule

@bravenel

After getting the corrupted rule a few days ago, I split the logic into 2 rules and was re-creating them from scratch to try to ensure they weren't corrupted.

This time, I added all the if/else logic first and I now see that it has unexpected "ELSE" and "END-IF" options at the bottom as soon as I started adding other lines.

As you can see, it looks clean.

However, as soon as I added one line to the top, I got the unexpected ELSE/END-IF options:

I'm not sure if that means the new rule is corrupted already--or if this is just a glitch in the UI?
Given the disparity between the interface and the backend code, it's impossible to actually know if the "back end" rule is corrupted or not since it can look fine on the UI but still not work as expected in some cases.

Note about the original rule you indicated was corrupted and my first attempt to recreate things tonight, as well: when both rules were at about the point shown here....

Cancel Timed Actions: Dash In and Out-Initialize and Entry
IF (Variable DashInOutHSMMode contains 'Away') THEN
Set SetStateStatus to 'Setting HSM Away'
HSM Arm Away
Wait for Expression: HSM status is Armed Away
--> timeout: 0:05:00
ELSE-IF (Variable DashInOutHSMMode contains 'Home') THEN
Set SetStateStatus to 'Setting HSM Home'
HSM Arm Home
Wait for Expression: HSM status is Armed Home
--> timeout: 0:05:00
ELSE-IF (Variable DashInOutHSMMode contains 'Night') THEN
Set SetStateStatus to 'Setting HSM Night'
HSM Arm Night
Wait for Expression: HSM status is Armed Night
--> timeout: 0:05:00
ELSE-IF (Variable DashInOutHSMMode contains 'disarm') THEN
// Assume HSM is already disarmed and this was triggered by the Dash In/Out Switch being triggered while disarmed.
ELSE
Notify Rob's Pixel 6 Pro and Speak on Garage Sonos, Basement Sonos, Basement Bedroom Sonos, Master Bedroom Sonos, Kitchen Sonos (volume: SonosVolumeNormal): 'WARNING: Previous HSM status isn't known. Arming in Home mode.'
Set SetStateStatus to 'Setting HSM Home'
HSM Arm Home
Wait for Expression: HSM status is Armed Home
--> timeout: 0:05:00
END-IF
IF (Variable DashInOutRingMode = 'away') THEN
Set SetStateStatus to 'Setting Ring Away'
setMode('Away') on Ring Alarm Hub-Ring
Wait for Expression: Ring Alarm Hub-Ring mode away
--> timeout: 0:05:00
ELSE-IF (Variable DashInOutRingMode = 'home') THEN

That last "ELSE-IF" was originally corrupted somehow. It appeared something like "ELSE-IF(( FALSE)" before I deleted it and recreated the ELSE-IF (which seemed to work).

Because that was very much like what I recall from the original rule, I suspect that may have been where the corruption came from. So, I am re-creating this rule all over yet again. This time (starting with only the conditionals), I didn't see any corrupted conditionals--just the unexpected ELSE/END-IF options. I'm hoping those are just a UI glitch.

Just a thought but I don't think you need all those other Else's before the End-Ifs. After your last Else-If in each case, you could just End-If?

It doesn't read correctly - "ELSE-IF this thing is true THEN ELSE END-IF

1 Like

@rob9 You may want to do a softreset prior to continuing in case the database itself is corrupt and possibly affecting things.

@johnwill1 Understand that this is just the skeleton--I was adding all the IF logic BEFORE adding the commands in each part.

There will be commands inserted after all the IF, ELSE-IF, and ELSE statements. The ELSE-IF statements are catching the specific values I want to handle--while the ELSE statements handle all the other possible values for those variables (and there are some others).

1 Like

Apologies - I only skimmed it - understood

2 Likes

So, I did a soft reset.

The odd ELSE/END-IF options were still there.

But, deleting the line I added at the top made them go away. Then, adding it back in made them come back.

1 Like

Maybe @bravenel has an idea

Oddly, those options stayed there as added 3 lines between the first conditional. I then added a 4th line that I really didn't need and deleted it. Then, those options at the bottom vanished.

Well, some other odd behavior.

I pasted this from the clipboard into the first IF/ELSE-iF/ELSE/END-IF group 4 places:

image

I then went into Manage Conditions and updated the "Wait" conditions (there were, as expected, several "HSM status is Armed Away").

I then ended up with the conditions showing properly in the "Manage Conditions" list--but 2 of them are blanked out in the rule itself.

After having deleted the bad "wait" statements and recreating them, it does appear that things are working correctly--so I have to hope there isn't any latent corruption this time around.

The display of the Else and Endif buttons after inserting the action before the IF-THEN is a UI bug.

3 Likes

Download the Hubitat app