Fixes source filter not working for `GenericEventTrigger` (#3837)
While reviewing https://github.com/openhab/openhab-js/pull/300, I noticed that filtering by source `org.openhab.core.expire` was not possible. This was because the specified source was checked against the event topic, which makes no sense at all given that different schemes. Source filtering is done inside the `apply` method. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>pull/3838/head
parent
e5518b9322
commit
176e23f296
|
@ -74,9 +74,9 @@ public class GenericEventTriggerHandler extends BaseTriggerModuleHandler impleme
|
|||
topicFilter = null;
|
||||
}
|
||||
if (module.getConfiguration().get(CFG_TYPES) != null) {
|
||||
this.types = Set.of(((String) module.getConfiguration().get(CFG_TYPES)).split(","));
|
||||
types = Set.of(((String) module.getConfiguration().get(CFG_TYPES)).split(","));
|
||||
} else {
|
||||
this.types = Set.of();
|
||||
types = Set.of();
|
||||
}
|
||||
String payload = (String) module.getConfiguration().get(CFG_PAYLOAD);
|
||||
if (!payload.isBlank()) {
|
||||
|
@ -104,11 +104,8 @@ public class GenericEventTriggerHandler extends BaseTriggerModuleHandler impleme
|
|||
public void receive(Event event) {
|
||||
ModuleHandlerCallback callback = this.callback;
|
||||
if (callback != null) {
|
||||
logger.trace("Received Event: Source: {} Topic: {} Type: {} Payload: {}", event.getSource(),
|
||||
event.getTopic(), event.getType(), event.getPayload());
|
||||
if (!event.getTopic().contains(source)) {
|
||||
return;
|
||||
}
|
||||
logger.trace("Received Event: Topic: {} Type: {} Source: {} Payload: {}", event.getTopic(), event.getType(),
|
||||
event.getSource(), event.getPayload());
|
||||
Map<String, Object> values = new HashMap<>();
|
||||
values.put("event", event);
|
||||
|
||||
|
|
Loading…
Reference in New Issue