OH3: NullPointerException on Button-Click

Hi,

currently in the process of migrating my OH2 setup to OH3.
In the browser-ui all the items, etc. are looking and behaving good/as expected.
But according to the logs I’m running into NullPointerExceptions.

The entries are created/displayed everytime a (physical) button/bwitch is being pressed
(got some Xiaomi switch-buttons and one Ikea on/off-switch, all connected via deCONZ-binding,
but none of their items are linked to any of my rules).

Currently on openHAB 3.1.0.M3, hoped switching to milestone would solve the problem, but it didn’t.
(Already reinstalled all my bindings at first and even OH as well.)

Log-Entry:

2021-04-26 00:09:39.262 [ERROR] [internal.events.ThreadedEventHandler] - Error on event handling.
java.lang.NullPointerException: null

Thing:

   switch                      Swtch_Onff_Ikea_01_Plrm       "Swtch_Onff_Ikea_01_Plrm"         [ id="65"] //

Items:

    Group      G_Swtch_Onff_Ikea_01_Plrm                    "Ikea-Button"                        <wallswitch>       (G_Lctn_Plrm)                                    
    Number             Onff_Ikea_01_Plrm_Button             "Button"                             <wallswitch>       (G_Swtch_Onff_Ikea_01_Plrm)                                                                     {channel="deconz:switch:phoscon:Swtch_Onff_Ikea_01_Plrm:button"}
    DateTime           Onff_Ikea_01_Plrm_Last_Updated       "Last updated"                       <time>             (G_Swtch_Onff_Ikea_01_Plrm)                                                                     {channel="deconz:switch:phoscon:Swtch_Onff_Ikea_01_Plrm:last_updated"}
    Number             Onff_Ikea_01_Plrm_Battery_Level      "Battery level"                      <battery>          (G_Swtch_Onff_Ikea_01_Plrm)                                                                     {channel="deconz:switch:phoscon:Swtch_Onff_Ikea_01_Plrm:battery_level"}
    Switch             Onff_Ikea_01_Plrm_Battery_Low        "Low battery"                        <battery>          (G_Swtch_Onff_Ikea_01_Plrm)                                                                     {channel="deconz:switch:phoscon:Swtch_Onff_Ikea_01_Plrm:battery_low"}
    DateTime           Onff_Ikea_01_Plrm_Last_Seen          "Last seen"                          <time>             (G_Swtch_Onff_Ikea_01_Plrm)

Have been looking all over the forums & google for hints of what i could do,
but didnt find any. Would really appreciate any of your ideas/solutions.

Thanks in advance.

Did you make a new Thing, or re-use the OH2 one?

I recreated everything from scratch.

Can I provide anymore information, or details for you? Really wondering if the messages / their cause is gamebreaking, or kinda acceptable for now. Thank you again!

You might try DEBUG logging on the binding, it may reveal which Item update or trigger event is connected to the message.

Or temporarily remove one of your text Things and see what gets discovered instead.

Thanks for your response.

Getting the same error for every ‘switch thing’ - even when deleted and added via the GUI.

I’m not getting any conclusions out of the logs, despite there’s one additional value called windowopen that is =‘null’ instead of =null - could this be a pointer?

OH2:

2021-04-28 19:41:51.334 [TRACE] [nternal.netutils.WebSocketConnection] - Raw data received by websocket: {"e":"changed","id":"60","r":"sensors","state":{"buttonevent":1000,"lastupdated":"2021-04-28T17:41:51.331"},"t":"event","uniqueid":"00:15:8d:00:04:07:54:3e-01-0006"}
2021-04-28 19:41:51.335 [TRACE] [ernal.handler.SensorBaseThingHandler] - deconz:switch:Phoscon-GW:mi_switch_02 received SensorMessage{type='', config=null, state=SensorState{dark=null, daylight=null, lightlevel=null, lux=null, temperature=null, humidity=null, open=null, fire=null, water=null, alarm=null, tampered=null, vibration=null, carbonmonoxide=null, pressure=null, presence=null, power=null, battery=null, consumption=null, voltage=null, current=null, status=null, buttonevent=1000, gesture=null, valve=null, lastupdated='2021-04-28T17:41:51.331', xy=null}, e='changed', r='sensors', t='event', id='60', manufacturername='', modelid='', name='', swversion='', ep='', lastseen='null', uniqueid='00:15:8d:00:04:07:54:3e-01-0006'}

OH3:

2021-04-28 19:45:27.067 [TRACE] [nternal.netutils.WebSocketConnection] - Websocket$1619260450738-1 received raw data: {"e":"changed","id":"60","r":"sensors","state":{"buttonevent":1000,"lastupdated":"2021-04-28T17:45:27.064"},"t":"event","uniqueid":"00:15:8d:00:04:07:54:3e-01-0006"}
2021-04-28 19:45:27.068 [TRACE] [ernal.handler.SensorBaseThingHandler] - deconz:switch:phoscon:Swtch_Bttn_Mi_02_Lvngrm received SensorMessage{type='', config=null, state=SensorState{dark=null, daylight=null, lightlevel=null, lux=null, temperature=null, humidity=null, open=null, fire=null, water=null, alarm=null, tampered=null, vibration=null, carbonmonoxide=null, pressure=null, presence=null, power=null, battery=null, consumption=null, voltage=null, current=null, status=null, buttonevent=1000, gesture=null, valve=null, windowopen='null', lastupdated='2021-04-28T17:45:27.064', xy=null}, e='changed', r='SENSORS', t='event', id='60', manufacturername='', modelid='', name='', swversion='', ep='', lastseen='null', uniqueid='00:15:8d:00:04:07:54:3e-01-0006'}
2021-04-28 19:45:27.069 [ERROR] [internal.events.ThreadedEventHandler] - Error on event handling.
java.lang.NullPointerException: null

So far as I can see, windowopen is supported and is a string type.

Could be related to:

I am facing NPE’s in ThreadedEventHandler while using HUE switches.
Are the switch buttons configured with a trigger channel? I don’t know how the deconz binding works.

Indeed seeming pretty similar to me, thank you for mentioning.

Yes, the binding is providing a buttonevent for the switches via a trigger-channel,
whose value in passed to a “last pressed” number-channel.

Just had a look on a HUE-Dimmer-Switch, also giving a NPE in the end.

2021-04-28 23:06:00.218 [TRACE] [nternal.netutils.WebSocketConnection] - Websocket$1619260450738-1 received raw data: {"e":"changed","id":"32","r":"sensors","state":{"buttonevent":1000,"eventduration":0,"lastupdated":"2021-04-28T21:06:00.216"},"t":"event","uniqueid":"00:17:88:01:02:e2:c5:8d-02-fc00"}
2021-04-28 23:06:00.218 [DEBUG] [nternal.netutils.WebSocketConnection] - Couldn't find listener for id 32 with resource type SENSORS. Either no thing for this id has been defined or this is a bug.
2021-04-28 23:06:00.251 [ERROR] [internal.events.ThreadedEventHandler] - Error on event handling.
java.lang.NullPointerException: null
	at java.lang.String.contains(String.java:2036) ~[?:?]
	at org.openhab.core.automation.internal.module.handler.ChannelEventTriggerHandler.apply(ChannelEventTriggerHandler.java:91) ~[?:?]
	at org.openhab.core.internal.events.EventHandler.dispatchEvent(EventHandler.java:143) ~[bundleFile:?]
	at org.openhab.core.internal.events.EventHandler.handleEvent(EventHandler.java:111) ~[bundleFile:?]
	at org.openhab.core.internal.events.EventHandler.handleEvent(EventHandler.java:84) ~[bundleFile:?]
	at org.openhab.core.internal.events.ThreadedEventHandler.lambda$0(ThreadedEventHandler.java:67) [bundleFile:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]
1 Like

Would be neat if you add your findings (binding, config, logs) to the linke issue, so we collect all relevant information over there too for someone who may be able to reproduce this.

I had an exactly similar issue in the log with Deconz buttons. I found I had created a rule in the UI rule editor to test the new engine that was not complete. When I removed/disabled the rule the error disappeared. Maybe a longshot but check if there isn’t another rule causing this.

1 Like

Thanks for sharing your findings.

That could be the reason for my environment too, since i have testing rules “lying around” nearly all of the time…
I will check my installation for such a case too.

I know it’s a very long time, but do you remember what was “incomplete” in the rule?