Hi
I just moved my rules from rules DSL to Jython and I have a few questions that I would like to ask.
- I cant get
@when("System started")
to work, jython script:
from openhab.rules import rule
from openhab.triggers import when
@rule("Initial setup")
@when("System started")
def initialSetupRule(event):
log.debug("JSR223: System started.")
createTimer( DateTime.now().plusMinutes( 1 ), initialSetup )
Error that I get:
[ERROR] [omation.core.internal.RuleEngineImpl] - @when: Exception [@when: "System started" could not be parsed because rule triggers do not currently support target_type "System"]: [Traceback (most recent call last):
File "/etc/openhab2/automation/lib/python/openhab/triggers.py", line 333, in when
raise ValueError("@when: \"{}\" could not be parsed because rule triggers do not currently support target_type \"System\"".format(target))
ValueError: @when: "System started" could not be parsed because rule triggers do not currently support target_type "System"
]
[ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/coop_rules.py': TypeError: 'NoneType' object is not callable in <script> at line number 100
And looking here it should be working
-
I have uC (microcontroller) that I want âtalkâ to via i2c, I got this part working in Python before I even started with OpenHAB. Before I switched to Jython I got advised here the best option would be to run my uC script as a service sort of independent of OH because I want every X seconds read data from it and send data to it when some OH rules are triggered. Since I have now switched to Jython wouldnât it be better to just import my uC class (with all i2c methods) from that script and call them in cron rule?
-
JSR223 and Jython. I would like to know if I understood everything right. JSR223 is a âfunctionalityâ that lets other scripting languages comunicate with Java (objects/classes/etc) and Jython is just Python using those âJava thingsâ, right? So
Jython = JSR223
butJSR223 â Jython
?