Channel-based Triggers - Grouping and implicit variables not possible

following up on this discussion I’d like to ask if there are any new techniques available in OH3 to group channels.

I have quite a few shellys which have a triggering channel for a set of alarm types

  • overheating
  • overload
  • overpower
  • load_error

I want to avoid creating a rule with more than 20 triggers and combine them with an or operator like this workaround:

does anybody know of an elegant way? It doesn’t have to be a grouping of channels. could be anything else

AFAIK you can’t group channels, only items

Other than it looking a little awkward, there is no detriment to simply having that man triggers for a rule. I don’t think you’re going to find a more compact option.

many thanks.
and now that receivedEvent is not an object anymore (just a string) do you know how I can find out which of those 20+ devices have triggered?

I do not think that is currently possible in DSL

wow - getting worse now…
that means that I need to create 20+ rules😂.
Maybe somebody out there already had that problem and found a workaround.

at least there is already a request on Github

The javascript event object in OH3 already has the channel property for channel triggered events. If you convert your rule over to js you can use one rule for all the channels.

thank you Justin. Would you say it makes sense anyway moving from xtend to javascript? Just for one rule it does not make sense to me to learn javascript. But if you say that e.g. one day xtend is dead then I would consider now to move on to js

If the full extent of this rule is just the logging action you have posted above then there’s not a lot of learning to do to convert this rule over to js. There are plenty of good examples here on the forum of how use logging in js rules and you can even setup the rule in the blocky editor and the see what its js output is then just modify that to include the information you want. If there’s more to the rule that you haven’t posted, then it might be a slightly steeper learning curve to get the rule into js.

There is, to my knowledge, no plan to remove the rules DSL from openhab, if you you choose to learn js for rules scripting it’s only because 1) there are some limitations to rules DSL that you can get around by using js (such as the one you have found here), 2) some more complex rules logic can occasionally be simplified by using js, 3) you just want to learn something new.

I personally, don’t hesitate to use different languages at different times; IMHO each is a tool with different strengths. Most of my rules are in js, but some are still in rules DSL and a few even in python. Some people aren’t comfortable with that kind of scattershot approach and prefer to have everything in one language. That has its advantages too.


well, haha, will give it a try.
many thanks for the time you took