from java.time import ZonedDateTime as DateTime
Then you just need to change getHourOfDay etc to their equivalent methods of ZonedDateTime. Most of the other methods have the same name, e.g. plusMinutes().
I detected another issue with the triggers: StartupTrigger is not working properly. By modifing the StartupTrigger class (around line 720 in triggers.py) I got it working:
Replace
self.trigger = TriggerBuilder.create().withId(trigger_name).withTypeUID("jsr223.StartupTrigger").withConfiguration(Configuration()).build()
self.trigger = TriggerBuilder.create().withId(trigger_name).withTypeUID(“core.SystemStartlevelTrigger”).withConfiguration(Configuration({
“startlevel”: “100”
})).build()
pail_frank23:
I detected another issue with the triggers: StartupTrigger is not working properly. By modifing the StartupTrigger class (around line 720 in triggers.py) I got it working:
Replace
self.trigger = TriggerBuilder.create().withId(trigger_name).withTypeUID("jsr223.StartupTrigger").withConfiguration(Configuration()).build()
self.trigger = TriggerBuilder.create().withId(trigger_name).withTypeUID(“core.SystemStartlevelTrigger”).withConfiguration(Configuration({
“startlevel”: “100”
})).build()
Thank you. I have updated my version on github too.
DerOetzi:
Thanks for the nice working version of this. But why don’t you open a PR for this to the official repo?
I am unsure whether an official fix may have already been prepared but not yet uploaded. It is also not quite polished. I commented out some things instead of removing them, and my replacement implementation is just a quick and dirty solution. I’d be happy to submit it as a PR if Scott wanted it.
Thanks, yes I found them later on. It was not that easy to migrate everything from these deprecated libs.
Right now it seems that most of my rules are working… Only executeCommandLines seems to have problems, even with the new parameter list.
Also it seems for me that System started triggers won’t fire on system startup. Is this possible?
rkrisi:
Also it seems for me that System started triggers won’t fire on system startup. Is this possible?
See above. I’ve pushed a new update that should fix the startup trigger, thanks to @pail_frank23
The only change was to triggers.py
Yes this seems to work, thanks!
One last thing which is not working for me regarding Jython rules is executeCommandLine. Did you get this working? I can’t really get any useful info why it is not working. I have changed the parameters as suggested in docs and other posts, but none of them worked. Basically it returns instantly with ‘None’, not even waiting for the timeout.