Maybe you meant this one.
You were right: At Startup Level 70, it sometimes worked (e.g. rule ran early enough to disable the other rule early enough), and sometimes didn’t (the first of the x messages got fired). See below the result of 7 identical restarts.
I looked into this, but was a bit reluctant to go for the (from what I understood) dominant option of working with groups that are to be restored on startup). From what I understood, going for this approach would mean that, going forward, I always have to remember to put all new items into this group, to ensure that they’re restored on startup.
Instead, I noticed that a file-based rule might run early enough to deactivate the rule early enough, which is what I’d like to verify. Though I’m struggeling with the Syntax, maybe you can answer two questions:
- Surprisingly “When System started” (file-based rule) appears to run early enough (though I assume this is the equivalence to “Start Level 100” (UI-based rule), so not sure why this appears to be running early than start Level 100). What would be the syntax to trigger it file-based by different start levels? There appears to be a gap in the documentation, which is why I’m struggeling.
- What’s the syntax to enable / disable rules in file-based rules? My attempt below was what I thought, but obviously it doesn’t work.
rule "Startup - Disable Rules"
when
System started
then
RuleManager.setEnabled(things_status_check, false);
RuleManager.setEnabled(things_status_notification, false);
logInfo("notifications", "Rules disabled.");
end