OH3: search in rules

I use OH3 with UI-only approach, meaning, the rules are not file based anymore (ok, JSONDB on filesystem).

Is there any way I can use a search over all rules to find a specific rule? I got around 50 rules or so, and I don’t remember, what I did on a rule like last year or so. To open the script-tab for each and every rule is exhausting. Is this planned somewhere or can I file a feature request here or on github?

Search the open issues and file a feature request if one doesn’t already exist.

In the mean time, you can open the JSONDB file and search through that file for the term you are looking for.

1 Like

I use tags to organise my rules. E.g. “productiv”, “test”, “lights”, “energymanagement”.

You can giva rule one or more tags and you can search for the tags.

Yes, definitely take advantage of tags. Also add meaningful names and descriptions to everything: rules, triggers, actions, conditions.

In the above rule I didn’t really need to add anything to the triggers but you can see that the name and descriptions for both the action and the condition explain what the script does. I’ve added a semantic tag as well as my own tags at the bottom.

But sometimes you’ll see an error in the logs referring to a variable name you’ve used all over the place or something like that and it’s unclear which rule the error came from. Sometimes a search cannot be avoided.

1 Like

I do find myself often in the situation, that I know I already solved a type of problem before. I remember some keywords or stuff, but I don’t know in what context aka tags aka name I used it…
So a fulltext search is needed my leaky brain.

I’ll file a feature request on github soon

When you figure out how to do something, put it into a Script with a proper name. It doesn’t even need to be a wholly working example. Scripts never run on their own so you can use them to build up a library of examples you can refer back to later.

Here’s what my Scripts page looks like.

Once I figure something out that I don’t want to have to look up again later, or something that takes a bit of trial and error to figure out, I’ll capture it here so I can find it again.

Depending on what it is, you might even be able to get away with putting the code here as a Script and then have your other rules just call it instead.

And there’s always the possibility of creating a reusable library.

1 Like

Ah, the age-old battle between “document everything!” and “I’ll remember that later”. Too often, I find myself on the lazier side of the conflict, despite a mountain of evidence that I will not remember. :wink:

Amortize it. Be lazy now but next time you have to search through top find something, document as you go. Before long everything that really needs documentation will have it and the rest probably didn’t need documentation anyway.

1 Like