Hi, I’m using the last version of opengab (3.0.1) and I have several string items that allways have to have some value, I allready create and script that assing a value when the system start. But iin that last day for some reason I can’t understand they where empty. So I wan’t to creat a rule to check if they are empty assing a value. But I don’t want to creat a rule for each item, so is there a way to have a rule with several ‘or’ triggers?
If you’re using the built-in RRDj4 persistence, then only numerical items will be restored. If you want string-type items, you need to use MapDB persistence.
To answer your question, yes, rules can have multiple triggers, and triggers are “or” by definition. But I don’t see why you’d need a rule to check the value of your string items. Just display them in a UI and they’ll either be
null or have a value.
Each trigger on a rule is considered an or trigger and you can add as many as you like.
However, there are built-in ways of handling that even more easily. For example, if all your string items can be added to a group then you can have just a single trigger on that rule that checks all the group member items.
See here for an excellent tutorial on making a rule work on your group.
Here is one of the places where the conditions (i.e. “But only if”) part of a Rule in UI rules really shines. Let’s say you have a rule that requires an Item to have a reasonable state (e.g. not NULL, UNDEF, etc.). Create a condition and add a Script Condition.
In that code check to see if the Item is a reasonable state. If not return false and the rule won’t run. Optionally, you can update the Item to a default value , wait half a sec and then return true. Depending on how the Items are set up and used, this can be a relatively simple and powerful way to handle this case.