[ERROR] using receivedEvent.getEvent() in a rule

I upgraded from 2.5 to OH 3 Milestone build 4 -> then to 5.

Probably should have done more reading but I was so excited after watching the presentation on OH3 that I couldn’t resist. One of the issues I am having is with the getEvent() in a rule not working. “This is a new rule I am testing out after the upgrade”

rule "Turn off all lights without separator"
    Channel "xmppclient:xmppBridge:xmpp:xmpp_command" triggered
    var actionName = receivedEvent.getEvent()
    if(actionName.toLowerCase() == "turn off lights") {

VSS is showing

method getEvent() is undefined for type String

Google doesn’t seem to be much help on this. Except for this one post that looks like my problem but it seems as if nothing was figured out. https://github.com/openhab/openhab-core/issues/706.

and I am not sure if it’s related but I am also getting this. These below I had running with no issues prior to the upgrade.

// There is probably a more elegant way to do this but it does what I need …

rule "Temp Cool"
	Item AC_Cool_It received command ON        

        AC_Switch_Timer = createTimer(now.plusMillis(ACSwitchDelay)) [|
        AC_Switch_Timer = null 

        AC_2hr_Timer = createTimer(now.plusMillis(AC_Time_2_Milisec)) [|
        AC_2hr_Timer = null
        sendCommand(AC_Cool_It, OFF)


I think there was some work done on the implicit varaibles. What if we take the hint from the error. Just log out receivedEvent. Maybe it’s just a String now and not an Object.


The receivedEvent was the raw event before instead of the channel event string. It has been changed to be a basic String now (the return value of getEvent(), see here).

1 Like

Great thanks guys I will take a look in a few hours when I get access and report back.

That worked!

I went from

var actionName = receivedEvent.getEvent().split("##")


var actionName = receivedEvent.split("##")

Thanks for the help…

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.