OH3: Error when using toString on a string item state

Since the migration to OH3 (OpenHabian) one of my rules doesn’t work anymore. With additional debug logs I was able to identify that the following lines don’t work anymore for some reason:

var String strHarmonyActivity = ST_HARMONY_CurrentActivity.state.toString
var boolean boolHarmonyDreamboxActivity = strHarmonyActivity.contains("TV")

When the rule is executed I get the following error in the log:

2020-12-30 00:06:27.501 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'default-6' failed: cannot invoke method public abstract java.lang.String org.openhab.core.items.Item.getName() on null in default

Sadly I didn’t find any solutions for this error in the forum. Any idea what could cause this error?

sorry cannot tell you what went wrong, if i put this line in my oh3 it works. maybe the error is somewhere else?

Sorry I just found out that the error does not occur in those two lines, but the line just after that:

logError("Test", triggeringItem.name)

I already found a thread about this problem and some issues on GitHub. It seems that triggeringItem now only works on “Member of” triggers.


Correct, but triggeringItemName works for the other times.

1 Like

it doesn’t work for me for some reason…
I’m now trying to migrate my oh 2.5 rules to oh 3.0
Here is what causes a pain for me for the moment:


With oh3 receivedEvent became a String.
Is there any list of all implicit variables that could be used in rules?