-
-
Notifications
You must be signed in to change notification settings - Fork 428
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
Allow using * as wildcard in thing status triggers #2832
Allow using * as wildcard in thing status triggers #2832
Conversation
Signed-off-by: Jan N. Klug <github@klug.nrw>
@@ -77,6 +79,9 @@ public ThingStatusTriggerHandler(Trigger module, BundleContext bundleContext) { | |||
this.types = Set.of(ThingStatusInfoChangedEvent.TYPE); | |||
} | |||
this.bundleContext = bundleContext; | |||
|
|||
this.eventTopicFilter = Pattern.compile("^openhab/things/" + thingUID.replace("*", ".*?") + "/.*$"); | |||
|
|||
Dictionary<String, Object> properties = new Hashtable<>(); | |||
properties.put("event.topics", "openhab/things/" + thingUID + "/*"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this used for? I didn't find code that uses this property. It also contradicts the description here which states that regular expressions should be used as filters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did the initial implementation based on the GenericEventTriggerHandler which uses nearly the same code for event subscription. Currently I cannot tell you whether there is a spacial purpose or not.
@@ -10,7 +10,7 @@ | |||
"type": "TEXT", | |||
"context": "thing", | |||
"label": "Thing", | |||
"description": "The UID of the thing.", | |||
"description": "The UID of the thing. You can use '*' as wildcard to match multiple things.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really related to your PR. Just wondering if we already have a way to translate these labels an descriptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that what ModuleTypeI18nService
and ModuleTypeI18nServiceImpl
is for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is right.
All we have to do next is to define the related property files for translation in JSON based module types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks.
Closes #2167
Signed-off-by: Jan N. Klug github@klug.nrw