-
-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable wildcard matching in DSL rules #4520
Comments
In the mean time, you can achive this in the UI through a managed rule and using a Generic Trigger with a filter for ThingStatusEvents. See https://community.openhab.org/t/thing-status-reporting-4-0-0-0-4-9-9-9/143180 for an example. Or you can just install that and use it as is since that rule tempalte solves exactly this problem. Though the limitation is that you cannot pass values to a called Rules DSL rule. So you'd want to use some other language for the called rule or if you want to stick to Rules DSL you might need to:
I think the ThingID will be in the
Based on some changes made to make Rules DSL Scripts callable like a rule from the UI using the run rule action, I believe this will work to pass data to the called DSL code. Of course all the usual Rules DSL Script restrictions apply (e.g. no imports, no return value, etc.). If that doesn't work, your only work around is to use something other than Rules DSL. Blockly should work though as well as any of the other languages. I'm not arguing against this request or anything like that. Just showing options to get the capability now without waiting for this issue to be addressed. When/if this issue gets addressed, I think it would be great if it were made generic and available to all the languages (where it's not already available, this seems like something jRuby would already support) without resorting to the Generic trigger. |
This is currently already supported. rule "Thing State"
when
Thing "*" changed
then
logInfo("ThingChanged", "Triggering Thing: {}", triggeringThing)
end |
Really??? Thats awesome! When did this get implemented? I've asked around over the years and no one could ever get this to work. |
Since #2832 |
Thank you! Totally missed that commit. |
I didn't know that was possible either. Unfortunately it doesn't work from the UI. There is the ability to select an "empty" Thing but the rule can't be parsed properly.
|
I run a series of health scripts when things change state. The majority of this is done through items that are placed in specific groups. When a thing state changes the rule triggers and checks for devices that have fallen off. Unfortunately, I still have to update the rules file for each individual thing rather than being able to use a wildcard to trigger the rule. The request is the ability to do a wildcard in the "when" section of a rule. For example:
versus
The text was updated successfully, but these errors were encountered: