How do I disable a rule?

How do I disable a rule in RM when a button on a controller is pressed?

When you go into a rule, at the bottom are restrictions. It seems the options are only time, days of week, mode or by a switch. To accomplish with a button press you could have a rule set a virtual switch “switch_restrictrule” to on then the rule would use that virtual switch in its restrictions.

Yeah… There is that. I was hoping there was a way to disable the rule. Kind of like what WebCoRE had for disabling pistons.

There is, and it’s what @rugby148 suggested. It’s actually even called “switch to disable rule”. If you want to control it via a button instead, just create a virtual switch that’s toggled by a controller button.

I see there is a disable with private boolean option which seems more like what I want. I just don’t want a ton of virtual switches in my setup that serve no purpose other than to disable rules. Unless of course that option does something completely different than what I assume.

I’m not sure why it’s an issue to have virtual switches. It’s just a visual piece of connecting code. You could even name them all as Zvirtual switch so they appear at the bottom of the device list. It’s the go-to method of connecting apps together… like button controller and RM.

It’s personal preference. Just like how some people prefer to use apps over rules. I only want devices in my list that represent actual devices I own. Personally I don’t see any reason why we need to have a virtual switch that is used to for the sole purpose of disabling another rule. In my opinion that is a work around for an app that is missing functionality.

1 Like

Look at it this way. How many different ways can a button controller be used? tap, hold, double tap… toggle or one button for on, one for off. What you’re asking for is having a whole button controller app inside RM when there’s no need for it to be duplicated there. Button controller does the work to create the switch logic specific to your needs, and RM uses that output through a virtual switch.

No-one is forcing you to do things this way, but this is the way the system is designed. Or switch to webcore and all the growing pains that encompasses while the bugs are ironed out. Your choice.

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.