[SOLVED] 'getEvent' is not a member error since OH 2.4

It would make much more sense to open an issue on GitHub as suggested above. May I ask you to do me that favor. Thanks.

Done :slight_smile:

Hi,
also run in this problem twice …
14 days ago, and than yesterday again.
clean-cache, restart oH not always help.
I minimize the addons.config, clean-cache, and replace the addons.config back to my original file.
After few restarts, clean-cache, Raspi reboot it’s working again, but … no real solution :frowning:

Has anyone news about the bug report, or any hint to prevent this issue with the cube?

Yes, indeed, the solution proposed does not work :frowning: so would be very helpful to unmark this thread as solved.

I guess I have found the issue report on GitHub. Unfortunately, nothing seems to happen there:

The same problem annoys me regularly at restarts of OH. In my setup my 4 Philips Hue dimmers suddenly don’t work anymore because the corresponding getEvent is no longer recognized. It regularly costs me a lot of time until it runs again. The bottom line is that there is no concrete way to do this. In the end there are countless restarts until everything runs again sometime.

My (simplified) code looks likes this:

rule "Dimmer Bed"
when
    Channel "hue:0820:<ID>:HueDimmer_Bed:dimmer_switch_event" triggered
then
	var String ButtonEvent = receivedEvent.getEvent() // often fails after OH restart
	var Number ButtonNumber = Integer.parseInt(ButtonEvent.substring(0,1)) as Number
	var Number ButtonState = Integer.parseInt(ButtonEvent.substring(3,4)) as Number
	// now react to different button numbers and states
	// ...
end

Did you ever find the solution? It’s driving me crazy :’(

Unfortunately not. I have also tried using openHAB 2.5M1 but still no effect. I was recently unable to get this working again (i.e. I am not able to get rid of this ‘getEvent’ is not a member error message anymore) and lots of openHAB restarts including cache clean-ups did not help either. Finally I gave up and decided to disable my code above in openHAB. Now I am using the Philips remote dimmer functionality programmed by the Philips Hue app which is not a solution at all.

Yes, me too. The worst thing is that the WAF of the whole home automation system sigificantly decreased because of me messing around with it for far too many times with no sustainable result. She rightly expects 24/7 working light switches and I am not able to explain plausibly why the system hangs again and again.

1 Like

Did anyone test it on the current snapshot build?

I too have tried this on stable, milestone1 and builds S1623 and currently S1641 (the current latest as of a few days ago).

I have managed to clear mine a few times by commenting out everything in all my rules files, clearing cache+tmp folder, restarting, then individually uncommenting rule files to bring the system up again. It doesn’t work everytime, but its the only way I have managed to get back up and running after getting this error.

I get both ‘channel’ and ‘getevent’ are not members of, where the receivedevent appears to be empty (null testing does not work, I simply can’t access .channel or .getevent as they are “not members of”).

Although no error appears on the logs during build, I have a feeling rules are loading/firing before items are properly initiated.

My setup currently is:
OH snapshot build 1641 running on PC with windows 10
Mqtt broker running on rasbpi
Grafana/influxdb running on rasbpi

My gut feeling is either rules are occuring before items load, or perhaps the restoration of item states from influxdb during OH boot is the issue. Admittedly I am hitting the channel trigger/receivedevent hard at times, so I may be stress testing or hitting this bug due to some limit I am unaware of.

Yes, see my other reply, tested on latest snapshot 1641.

Also lmao about WAF, not just that, the inconsistent and intermitant bug is destroying my own soul :frowning:

Thanks for your reply. To make sure - your comment reads a little bit like the errors only occurred during start-up of OH. Did I understand that correctly? Or did they occurre the whole time?

Ah sorry, I was not clear about that. They will appear at any time (instantly, minutes or even days later) and once they do the only way I have managed to clear them is stopping OH, deleting cache+tmp folders and starting OH with all rules containing a “receivedevent” trigger removed (commented out). Even then, maybe only 1 in 10 restarts manages to boot completely without the error appearing. If the error does reappear on the next boot, I have to repeat the procedure of cleaning those folders out until it comes back again. To be clear, “boot” includes both stopping (system:shutdown) of OH and/or restarting the computer.

In reffering to watching the logs during boot, I was searching for maybe some error/warning that might describe what is happening e.g. package installation error or bad loading of files.

Alright. Thanks for clarifying. Bad news are I still have no clue why all the sh… happens. Will investigate further.

Not that this is useful, but the exact error presented in “openhab.log” is

2019-07-24 19:43:32.726 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'MQTT_LISTENER - telemetry_listeners#health_topic': 'channel' is not a member of 'org.eclipse.smarthome.core.thing.events.ChannelTriggeredEvent'; line 576, column 29, length 21

This repeats for each failed trigger.

My mqtt (v2) is configured as:

    Thing topic telemetry_listeners "telemetry_listeners"{
    Channels:
        //health
        Type string : heating#health_topic          "heating#health_topic"          [stateTopic="heating/health",trigger=true]
        //... each device has its own like this
}

And the rule is in this format:

rule "MQTT_LISTENER - telemetry_listeners#health_topic"
when   
    Channel "mqtt:topic:mosquitto:telemetry_listeners:heating#health_topic"         triggered or
    Channel "mqtt:topic:mosquitto:telemetry_listeners:bedroom#health_topic"         triggered or
    // other triggers of the same format
then     

    var String logrulename= receivedEvent.channel.id.split("#").get(0)+"health_topic"
    var String debugdata = "Success"
    
    try{

        //logInfo(logrulename, "Topic and Payload")
            //logInfo(logrulename, "starting")

        //var thingUID = receivedEvent.channel.thingUID.toString; // ID portion of channel (everything after the last ':')
            //logInfo(logrulename, "thingUID="+ thingUID)

        var id = receivedEvent.channel.id.toString;  // Thing ID portion of channel (everything before the last ':')
            //logInfo(logrulename, "id="+ id)

        var deviceid = id.split("#").get(0)
            //logInfo(logrulename, "deviceid="+ deviceid)
        
        var payload = receivedEvent.getEvent()
            logInfo(logrulename, "payload="+ payload)

         // left rest of rule out for brevity 

Essentially I have my devices broadcasting telemetry data in a set format, and the items in OH with a naming convention allowing me to use one rule for all devices to findfirst the item based on the topic.

Since I sometimes send all, or partial data in a payload in json format, the normal channel binding way is not a viable option, since it fails/complains if the payload doesn’t contain a key which is sometimes absent.

Of course, the fact one rule can handle any topics/triggers I assign to it without creating more channals and editing the items is ideal, saves lots of code changing… if this worked all the time anyway haha

I had the same problem and tried the assignment as shown here. I got rid of the error, but have other problems. At least no missing things!

Hello all,

i recently updated to openHAB 2.5.9 Release Build. Since then, the solution above (sudo systemctl stop openhab sudo openhab-cli clean-cache sudo reboot) did not work any longer.

I can’t get rid of ‘getEvent’ is not a member error .

Does anyone have the same issue or ideas to solve this problem?

thank you all

Cleaning cache repeatedly can introduce this error. Leave the cache alone now, and try a simple reboot with cache in place.

thanks @rossko57 for your reply,
unfortunately that won’t help. Any other ideas?

Show us your rule. Show us your error message.

Error:

2020-11-09 16:46:44.216 [vent.ChannelTriggeredEvent] - mihome:sensor_switch:7c49ebb0dd2d:158d0002c8c8ed:button triggered SHORT_PRESSED

==> /var/log/openhab2/openhab.log <==

2020-11-09 16:46:44.230 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Mijia & Aqara Wireless Switch2’: ‘getEvent’ is not a member of ‘org.eclipse.smarthome.core.thing.events.ChannelTriggeredEvent’; line 79, column 22, length 24


Rule:

rule “Mijia & Aqara Wireless Switch2”
when
Channel “mihome:sensor_switch:7c49ebb0dd2d:158d0002c8c8ed:button” triggered
then
var actionName = receivedEvent.getEvent()
switch(actionName) {
case “SHORT_PRESSED”: {
Yeelight_1_Power.sendCommand(ON)
Yeelight_2_Power.sendCommand(ON)
sonoff_s20_1.sendCommand(OFF)
//Yeelight_3_Power.sendCommand(OFF)
//Sonoff_Socket3.sendCommand(ON)
}
case “DOUBLE_PRESSED”: {
Yeelight_1_Power.sendCommand(ON)
Yeelight_2_Power.sendCommand(ON)
sonoff_s20_1.sendCommand(ON)
//Yeelight_3_Power.sendCommand(ON)
//Sonoff_Socket3.sendCommand(ON)

    }
    case "LONG_PRESSED": {
    Yeelight_1_Power.sendCommand(OFF)
    Yeelight_2_Power.sendCommand(OFF)
    sonoff_s20_1.sendCommand(OFF)
    //Yeelight_3_Power.sendCommand(OFF)
    //Sonoff_Socket3.sendCommand(OFF) 
    }
    case "LONG_RELEASED": {
      
    }
}

end