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

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

or should i bypass the “getevent” problem via using any different command than getevent and case?

Thank you all