Private Boolean

HI, i've tried this same rule with a private boolean and also a variable but i have the same issue. Once all of my lights turn off, the boolean does not turn back to true. What am i missing here?

So basically i have an aqara wall switch and i want any of the buttons to turn all 3 lights on in the 1st press. But after the first press i want the buttons to toggle as a normal light switch would. Once all lights turn off, the process begins again when any button is pressed.

Also as a side isue, this rule turns my light on and off twice as slow as when i have a basic IF/THEN statement. Is there a way to speed this up? Have i overcomplicated the rule. (i'm fairly new from ST and webcore and i'm not a teccy, nor do i understand the logs) Please help


What build are you on?

I'd say so. Why do you need to put all of this into a single rule. You have three basic actions, each in response to a specific button push. Why not just 3 simple rules, each with a single button as trigger? No need to have all of those conditionals. You could do this easily in Simple Automation Rule, one for each button. Or, use Button Controller, one action for each button.

1 Like

Hi, I'm using a C7 on 2.2.5.131

I appreciate your comments. Even though you say I can simplify this, I'm also using it to build my knowledge and understanding of RM. So I guess I'm still trying to work out why the PB doesn't change at the end of the rule. Any advice would be appreciated. Also, any of the 3 buttons pressed turns all 3 bulbs on. After that, the buttons work independently per bulb until all 3 bulbs are all off. How could I facilitate this with button controller. Cheers for your help in advance :+1:

You could greatly simplify your Rule. Keep your Triggers as-is.

Maybe change your actions as follows

IF (Private Boolean is False) THEN
    On: SPOTLIGHT KASPER 1,  SPOTLIGHT KASPER 2, LAMP KASPERS
    Set Private Boolean True
ELSE
    IF (LIGHT SWITCH KASPERS pushed() = 1) Toggle SPOTLIGHT KASPER 1, SPOTLIGHT KASPER 2
    IF (LIGHT SWITCH KASPERS pushed() = 2) Toggle LAMP KASPERS
    IF (LIGHT SWITCH KASPERS pushed() = 3) THEN
       Off SPOTLIGHT KASPER 1, SPOTLIGHT KASPER 2, LAMP KASPERS
       Set Private Boolean False
    END IF
END IF

There are many ways to approach this, including the use of Hubitat Groups, using Simple Automation Rules, etc... But, since you asked for a RM example, I am hoping that this might help a little. Note: I have not tested this, but it should be close to what you've requested.

I'm not sure, and I don't know why it threw the error it did. PB isn't set because of the error. It's the error that I'm not understanding yet.

Cheers for this, it looks far simpler. Appreciate your time

1 Like

Thanks Bravenel. Fingers crossed you find a resolution

The original rule has 2 If statements, with 3 End-If Statements.

3 Likes

Hi, so, are you saying that if I delete the 3rd END IF, this will resolve the issue. I'm not home to test

Honestly I am unsure, but it is a syntax error and I noticed you had an error in your logs. I would give it a try and see if you get the expected behavior.

1 Like

Appreciated, I'll give it a whirl

I didn't notice the 3rd END-IF. That would definitely cause the error.

2 Likes

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