Activate / deactivate a rule

I agree, hopefully not removed as that would shutdown all my work with OH2.

Rules is all over the place right now, NGRE, Jython, Python, Rules DSL etc etc etc. No wonder its confusing for people.

Wow… you guys totally misunderstood me (sorry!). I was meaning the rule engine, not the rules created in .rules files. These will preserved in some way, either through a migration tool or getting them to work in the new rule engine… that is understandably a necessity! But the old rule engine itself is likely to be taken out back,…

1 Like

The distinction between the Rules Engine and the stuff you do to create Rules is not well understood by most users. As far as most users are concerned, .rules files are the Rule DSL rules engine. And because you said “rules DSL” which stands for “rules Domain Specific Language” it sounded like you were saying the language was going away, not a change in how the language is executed which, from the user’s perspective, is what is happening.

1 Like

I have almost all my rules able to be toggled, as sometimes I want to disable them. I also use the NGRE, but have all the toggles with the rest of my items, in the sitemap, in groups, within a specific frame.

My rules are created as normal, however I have modified the API calls to generate associated items and link those items to toggle the rule state. They are all added to a ‘gRules’ group that I display on the sitemap. For example:

rules.SwitchableJSRule({
    name: "AC-Manager",
    description: "Manages HVAC system",
    triggers: [
        triggers.GenericCronTrigger("0 */5 * * * *") //every 5 mins
    ],
    execute: doExecute
});

You are welcome to use my libraries if you like, even if for examples on how to do it, although they are likely to change in future.

1 Like