2019-10-09 23:44:43.051 [INFO ] [personal.jsr223core.rule.RuleFactory] - Input: '{switchTestInput_e0f4ea91eadd11e9944a9ef7ff3702ce.oldState: OFF, switchTestInput_e0f4ea91eadd11e9944a9ef7ff3702ce.event: switchTestInput changed from OFF to ON, oldState: OFF, module: switchTestInput_e0f4ea91eadd11e9944a9ef7ff3702ce, switchTestInput_e0f4ea91eadd11e9944a9ef7ff3702ce.newState: ON, event: switchTestInput changed from OFF to ON, newState: ON}'
The problem is that the item appears to be switchTestInput_e0f4ea91eadd11e9944a9ef7ff3702ce, where it should be switchTestInput.
The problem arises when I use the item name in my event handler.
I am 100% sure it worked before upgrading. I have downloaded latest jsr223 scripts.
I use the Helper Libraries and have no experience with creating Rules in this way. Using the Helper Library the code would be:
from core.rules import rule
from core.triggers import when
@rule("Some rule name")
@when("some trigger")
def rule_func(event):
rule_func.log.info("Input: '{}'".format(event.itemName))
I know that @5iver has been busily at work on both the core and the Helper Libraries so it’s likely something has changed. But I’ve no experience with building Rules without the Helper Libraries so I don’t know how it’s supposed to work.
My “problem” is that this code is pretty old, actually I started developing it with the first jsr223 library. And I guess JSR223 has changed pretty much in the mean time So it might be time for some rework
Hello, Martin! I can’t tell from your code snippet if you are using extensions or the raw API to create your rule. I highly using the decorators, since this will simplify things quite a bit, and provide additional functionality. You mentioned that you’ve updated to the most recent helper libraries, so be sure to read through the updated documentation. Specifically, the Event Object Attributes and the sentence right before the table is pertinent to your previous question.
I use the openHAB extension, and inherit from that. I started way back when the new Rule Engine was in something like Pre Alpha Very Early Release state. When I looked carefully into my code i figured out that I have just beeen lucky that it did work before.