Beginner question: having a global mode to activate / deactivate rules


I’m a new one with openhab

I would like to have something like a global mode selector.
This global variable could be used to deactivate some rules depending on its value.

Example: mode=(alarm)Armed so all rules for switching on lights can be disabled.
Mode=auto, lights rules are all activated
Mode=Night, only low light rules are activated

I’ve read a couple of things around scenario, but they looks more like a list of actions to do when we start a scenario, mode is more to change openhab default behaviour/rules.

Any idea to implement this without adding a dozen of “if” in the rule’s “when” ?
is there a way to make somekind of link between an virtual item state and rules ?

Thanks for your help

Have you checked the different options when creating a rule via the gui?

There you can select the action to enable or disable rules.
Just create a rule which gets triggered when your item state changes. With this rule you enable or disable the other rules depending on the items state.

Super, thanks :slight_smile:
I was trying to find something way more complex…

Just need to figure out how to group or list the rules that need to be ON or OFF

Again Thanks