Wrote my own simple Mode Manager

I'm puzzled by the 2nd IF-THEN statement. It's true (the time is within the window), but the statement is deemed false?

I'm running a C7 hub with 2.3.4.110.

It looks like you have a second condition semi-stuck that's evaluating to false (note the (T)(F)). I'd delete the line and re-create it.

See that extra "(F)" there, with no corresponding condition? Something got messed up. You can try erasing the expression and starting again.

Also, if you expect only one of these to be true at a time, you could use ELSE-IF instead of completely separate IF THENs, but that won't cause this problem and would be logically equivalent, just more efficient for both you and the hub. :smiley:

I removed the Night variable, and hard coded the 10:00PM. It now looks as expected.

I keep moving between my RM rule, and the new built in mode manager trying to find which one is rock solid :-).

The variable wasn't the problem; it was some "phantom" condition in your expression, which must have been removed in the process of doing whatever you did above. It should work as expected with the variable, too, if you wanted to add that back.

Both a rule or Mode Manager should work equally well, though some features may be easier to implement in one or the other. As you know (but seems to trip up some new users), Mode Manager doesn't define modes per se--it's just an easy, built-in way to automate changing them, and you're free to use anything that works well for you.

On the note of variables, I see you have a local variable defined. That won't work as a trigger, but nothing outside the rule can change it, so it should be needed to be used in that way (and the UI probably won't let you do it in most places). It can be used as a condition, or a hub variable could be used for either.

Thank you for the detailed response!

Thank you for the suggestion, but my brain works better with simple IF THEN statements unless there is only one other action, in which case I'll try IF THEN ELSE.

As a hack coder, I always prefer to write in a fairly straight forward way where I can see others like to code with "if this isn't true, then don't do this" LOL.

Is this better?

I'm used to clean IF-THEN-ENDIF or IF-THEN-ELSE-ENDIF. It seems like I'm missing a couple END-IFs LOL.

No, possibly worse, though again equivalent in outcome :slight_smile: ELSE-IF is specific an action available from the "Conditional Action" menus, the same place you insert IF THEN in the first place, and I'd recommend it over nested ELSEs for readability if nothing else whenever it's logically equivalent, at would be here.

2 Likes

All set, thank you for your help! Here is a tough one...

The built in Mode Manager displays the current mode in the app description. I sure would like to add the current mode into my RM Mode Manager description!

I tried the obvious ... adding %Mode% to the RM description. Nope.

I then tried adding a global variable for Mode_Manager_Value set to %Mode%. Nope.

I then added %%Mode%%. Nope.

Any suggestions? Or am I barking up the wrong tree? :slight_smile:

You can't modify the rule name from the rule actions, only manually, so that won't work.

1 Like

That's a shame. I really like how the built in Mode Manager displays the mode :-).

Is there a reason you don't want to use it then? :slight_smile: It should be be able to handles what your doing in this rule.

I keep trying it (built in Mode Manager) because I want to use built in functionality, and love the mode display.

It then glitches somehow, and my mode does not change. I'll be wondering why the lights didn't change, and see that my mode has not switched. I set it up simple like my RM rules.

When it does not work, I just go back to the tried and true RM approach.

Is there something wrong with the following?

That looks like it should work. I see you have logging enabled. If it doesn't work, I'd look at Logs to see what they show for Mode Manager to know where to start troubleshooting.

2 Likes

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