AVM Fritz! Binding gives NullPointerException for heatingModel

After upgrading to openHAB 4.1 (from 3.3), I sporadically see this exception:

2023-12-30 15:52:20.628 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.avmfritz.internal.handler.AVMFritzHeatingDeviceHandler@3b5de336': Cannot invoke "org.openhab.binding.avmfritz.internal.dto.HeatingModel.setTsoll(java.math.BigDecimal)" because "heatingModel" is null
java.lang.NullPointerException: Cannot invoke "org.openhab.binding.avmfritz.internal.dto.HeatingModel.setTsoll(java.math.BigDecimal)" because "heatingModel" is null
	at org.openhab.binding.avmfritz.internal.handler.AVMFritzBaseThingHandler.handleCommand(AVMFritzBaseThingHandler.java:580) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:147) [bundleFile:?]
	at org.openhab.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [bundleFile:?]
	at jdk.proxy1399.$Proxy1536.handleCommand(Unknown Source) [?:?]
	at org.openhab.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:95) [bundleFile:?]
	at org.openhab.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [bundleFile:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:147) [bundleFile:?]
	at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:840) [?:?]

After this exception occurred, even the UI is frozen. Only a reboot brings back proper operation. Since heatingModel seems to be an implementation detail, I expect there to be a bug in the binding. I’m using the latest firmware 7.57 for my AVM Fritz!Box 7590, my openHAB 4.1 is running inside a Docker container.

Does anyone have a suggestion how I can fix this or even find out what is causing this? A search here did not show up that anyone else had this issue, only something related in AVM Fritz Binding things unknown after upgrade OpenHAB 2.5 to 3.4 – but before recreating all the items, I’d prefer to investigate on the issue.

Best regards,
ceedee

I think, I found the reason: in my Fritz!Box I could see another device periodically logging in – at least trying to log in. It was using the wrong credentials. After I stopped that device from trying to log in with wrong credentials, the issues have not re-appeared. Thus, I’m assuming that there was some race condition in the plugin paired with a security-protection in the Fritz!Box causing the NPE.

Of course, it would still be good to make the Binding more resilient in such cases.