Closed hemagi closed 3 years ago
I've stated several times here and in the forum that this has been broken, along with the OSGIEvent Trigger, since OH 2.4 S1319. I have an update with fixes and will compare them to what you have put together before I push. Thank you!
Potentially it is better to implement
@log_traceback
def handle_directory_event(self, event, kind, path):
self.rule_engine_callback.triggered(self.trigger, {
'event': { 'event' : event,
'kind': str(kind),
'path': str(path),
}
})
Resolved in #368 and added to core.triggers in #373.
Describe the bug The _DirectoryEventTriggerHandlerFactory in 100_DirectoryTrigger.py and therefore the DirectoryEventTrigger doesn't work at all and, after fix, does not provide the necessary information in the event.
To Reproduce In a module I defined a helper class with some triggers, i.e.
Using this trigger and after adding a file to the watched directory one gets:
I fixed this in 100_DirectoryTrigger.py by adding
to
(the latter method setRuleEngineCallback() was never called and should be removable).
After this one gets not the expected event, because only the 'event' entry is taken from the callback parameters.
Therefore I replaced
by
At the end the handler became
in order to work as expected.
Environment (please complete the following information):