I am seeing a very slow UI when using the admin interface to view rules. I don’t have to do it very often, but occasionally when I need to manually trigger a rule it can be painful. I currently have 697 rules. I believe that the slowness is within the UI, because all rules and their related data are eagerly loaded into the browser. It will not work on my phone at all (just hangs when I click the Rule link), and is pretty slow on my laptop (m1 macbook pro) as it seems to struggle trying to render everything (and scrolling down the list gives blank sections that eventually render after hanging the browser for a while).
This post is to ask whether there is a known or advised limit on the number of rules?
I am using openhab 4.1.2. Interestingly, whilst I have more items than rules, the items list has no problems at all. Is this a bug? Should I file one against the UI?
Yes, you should definitely file this issue to bring it to the attention of the UI devs.
The rules and the items are loaded a little differently so it’s not too much of a surprise to see this different response. The main differences between how they are loaded are 1) because it was expected that item lists could get very large, it uses a list rendering method that allows for more performant dynamic loading, but as rule lists were just not expected to get nearly as large, its list is loaded in one step, 2) there is a lot more secondary processing on the rule list than on the items. These two things could easily combine to result in a much slower rule list rendering time if your list is large, and I think there are probably some changes that can mitigate the problem (although not alleviate it entirely).
It might also just plain be worth assessing whether you can reduce you rule count with more general rule versions; 700 completely separate functions seems unlikely so there must be ways to better manage that monster list.
I can certainly reduce the list to some degree - many of the rules are for item states derived from other items’ states, proxy items, etc. Some of these do benefit from individual rules as this allows manually triggering for a specific case/item, but certainly not all of them.
I have 192 rule files and haven’t even started automating the house… all up 9,000 lines; maybe 10 rules per file on average.
So I would expect at least another couple of hundred rule files, hence, ending up with 500 or thereabouts.
So jpg0 is only 200 further than me… which seems to be a lot, but not outlandish either.
There is one area that could be potentially improved (I just don’t get it how, and may post for feedback), which are the rules for smart plugs
While they sound simple they actually enforce a desired state in case the power goes or the plug lost its plot. In any case, five rules per plug, having 10 plugs and I have 40 rules for those alone. A similar thing applies to Zigbee DIN rail relays…
Anyway, I digress… I simply wanted to state my opinion that 500 rules can be normal?!
Also I agree about the rule count, particularly with sets of rules around specific hardware. I have a similar situation to you where some pieces of hardware each have a number of rules around them. Sometimes it’s possible to condense these rules to that they apply across all instances of the hardware, but not always. It can also make the code more complex when doing so, and will typically prevent manual triggering of the rule for a specific item impossible.
Small update: I have discovered that the performance issue is with the streaming updates. I have disabled these for rules for the moment and my UI is now super-snappy!