How do I disable a rule?

Why does it feel like you're being argumentative here? The way you are proposing is a valid work around, just not one I want to use.
I did have WebCoRE installed but there were performance problems I was seeing, so I removed it. Not to mention I have to figure out what needs to be re-written to work with button controllers in HE.
Much of switching to Rule Machine is learning the new app.

Another thing i have done, since you can only have a single switch disable a rule is I have a virtual switch per rule (named clever), but I also have a ā€œno rules/automationsā€ mode that is added to every rule. I manually set that mode if i am doing some wiring, testing, etc. and donā€™t want any rules to run during that time. i also use it for rule troubleshooting. remove that restriction from the 1 rule i am testing then set the mode. this prevents me from having to turn off dozens of rules individually or i can turn off a single rule (or more with the switches).

2 Likes

If you want to have a different method within RM, then put in a suggestion in the Feature Requests subforum. What about if virtual devices were optionally displayed in a separate list from physical ones? It seems your issue with this method is largely aesthetic rather than functional.

Looks like setting the private boolean will do what I need:

ā€¢ Enable/Disable with private Boolean?
This setting allows the ruleā€™s private Boolean variable to act as an enable / disable selector. If this option is selected, then the rule is enabled when its private Boolean is true, and is disabled when its private Boolean is false. Other rules may set the ruleā€™s private Boolean. The private Boolean variable is initialized to true when a rule is created, so when selecting this option to use private Boolean to disable, the rule will start out enabled. When the rule is disabled, the rule will do nothing, all outstanding timers are ignored.

1 Like

Cool! I saw it but didnā€™t know how it worked. Documentation!

Help with disable rule not working the way I thought it would.

I have VLC Thing speaking "Front Door" and then playing an mp3 for the door chime. All working fine. I set restrictions so that from 10:30pm to Sunrise, it would not make any sound. This too works fine. But then I thought I would also add a switch to disable the rule entirely, thinking this would allow me to enter or leave in silence before 10pm or after sunrise.

While the switch does not effect the 10:30pm to Sunrise restrictions for TTS, it does for some reason do the opposite of what I expected when it comes to the mp3, So when the "disable rule" switch is turned on, it allows the mp3 to play during the time restricted period, which I can't see why it should. What am I missing here? There is an additional rule that automatically re-arms TTS and the mp3 chime by disabling the switch I'm using to disable the TTS rule, once the door has been opened. I thought is was a timing issue, so I delayed the re-arming by 10 seconds, but the results are the same.

@bravenel Any clues here? The time restriction is able to completely disable the rule and no TTS or track is played, but the "Switch to disable Rule" only stops TTS, while "Play Track" proceeds as if the rule was still enabled. I see no events listed for this rule and none were generated when I ran it. The log entries were all that I found.

It's virtually impossible to make sense of your logs. What is turning on/off Silent Passage? That's not shown in your rule.

I'd need to see screen shots of isolated logs, especially one for Speak Front Door. None of those log entries appear to be from your rule.

Silent passage is manually turned on and automatically turned off 10 seconds after the front door opens by a separate rule.

Sometimes I just need a little shake to clear my head! Your comment made me look closely again at the logs and I noticed I had forgotten about a rule I had created at first to cover the front and back doors, but then changed my mind and separated them. So the rule "Door Chime" which had "Front Door" or "Back Door" as triggers and "VLC Thing : Play Track : Doorbell1.mp3" as the action, was still enabled. :man_facepalming:

Thanks.

Haha, don't we all.

2 Likes

Hi everyone

I am trying to get my head around Private Booleans in RM.
I am currently migrating our House from STT (webCoRE) across to this excellent platform.
I do think that Private Boolean will simplify what I am trying to achieve but my brain just cant resolve.
So can anyone out there help?

What I am trying to do is differentiate between physical and programmatic switch activity in rules as opposed to device level.
For example, we have sidelights in all the bedrooms that are programmatically activated by motion in a room after a time threshold. Physically switching off the sidelight then activates a SleepMode virtual switch which prevents motion activating lights in that room. Next morning physically turning on the sidelights turns off the SleepMode virtual switch thus enabling motion-activated lighting again.
(When I get my head around Private Booleans I am sure I will be able to remove the SleepMode virtual switch to prevent the Motion-activated lights).

I have got this working by using the physical switch (Sidelight_Dev) & 2 separate virtual switches; 1 for programmatically turning on/off the physical switch (Sidelight_Prog) which also follows the physical switch and another acting as a Flag/Guard (Sidelight_Flag). The Sidelight_Flag is enabled to Auto off in 5 secs which gives these rules time to fire :wink:

Then I have defined 5 RM rules to implement.

  1. Sidelight_Prog ON Triggered Rule
    53
  2. Sidelight_Prog OFF Triggered Rule
    01
  3. Sidelight_Flag ON Triggered Rule
    51
  4. Sidelight_Dev ON Triggered Rule
    16
  5. Sidelight_Dev OFF Triggered Rule
    43

This all means that in separate rules I can test for the state of the Sidelight_Flag to determine if the switch has been physically used; OFF = physical, ON = programmatic.

Here is an example -

Are you still with me?

Can this be implemented with a Private Boolean to remove the need for the Sidelight_Flag virtual switch?

I would appreciate your inputs -

The difference between a Private Boolean (PB) and a Virtual Switch is that a PB is a component of a Rule vs 'storage' outside of Rule Machine.

Each and every Rule has a PB an option. Therefore, to swap a virtual switch in your Rules for a PB, you have to pick a Rule to be the PB for this 'system' of Rules you've built.

You'd swap 'true' for on, and 'false' for off in those places where you're turning the virtual switch on/off. You'd set true or false using the name of the Rule you picked to have the PB.

Example from one of my Rules:
56%20PM

Which can be used as a Condition of a Rule:
41%20PM

The use of PB is very similar to using a Virtual switch.

If you go one step further, you can use a Virtual Dimmer as a variable, able to store numbers between 0 and 100. Use this in many ways but an example is to compare the dim level of a light against the value in a virtual dimmer. If a RULE set a light to be 34% and also set the Virtual Dimmer to be 34, then you could tell if someone manually turned on a light because it wouldn't be 34%. As in, motion turns a light on (to 34%). 3 mins later it turns off.. UNLESS someone manually changes the dim level.. then the light doesn't turn off.

Okies I am starting to get my head around.
I have used Triggered Rules to discretely identify on/off actions on each device.
I am thinking that a Private Boolean would best sit in a Rule that encapsulates the virtual Prog switch.

SO can I define a single Rule that fires on ether the Prog switch turning either ON or OFF?
As you will see from the GuestSideProg-[ON | OFF] rules above they both set the Flag switch.

There is a restriction under each rule that allows you to disable the rule when it's PB is set. I've used this without requiring another rule to be the PB as you've shown. So in my case I had 2 rules. the first rule runs and sets itself to false then another runs and set's it back to true when needed.

Personally I think there are redundant features in RM when it comes to disabling rules. This can make the engine more confusing than it needs to be.

Hm........

So is it correct to say that a Private Boolean is a Boolean variable limited in scope to the rule in which it exists?

From what I have found a rules PB can only trigger or match a rule that it is defined in. However other rules can change the PB of any other rule. Does that make sense?

You can make it arbitrarily complex by manipulating multiple PB each change, but at a certain point, the use of a pseudo global in the form of a virtual makes more sense.

You know..... I never looked at a virtual switch as a sudo global variable. Interesting take.

A lot of people are using a virtual dimmer as a counter. You can "store" a number between 0 and 100. I've also heard of people setting the virtual dimmer to be the value of a dim sent to a real dimmer. Then later, you can compare the dim value of the real against the virtual. If it's different, then you conclude a human touched the dimmer switch as a signal to alter the outcome. Example... Sunset sets a room's dimmer to be 34% and the automation also sets the virtual dimmer to be 34%. Then along comes a person and, by changing the dim level even a tiny amount, makes it not 34% and thus the Automatic Lights off at X doesn't occur.

1 Like

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