AVM Fritz Binding suddenly throws NPEs

Hi everybody!

I stumbled upon a problem with the FritzBox Binding (avmfritz) for OpenHab2 (Snapshot) - which started right after the update to the new deb-format (openhab2 instead of openhab2-offline). However, I frankly do not understand what happens:

Since the update, all my AHA things are not updated anymore, with the following exception thrown:

2017-01-11 14:52:49.968 [ERROR] [.binding.avmfritz.handler.BoxHandler] -
java.lang.NullPointerException
        at org.openhab.binding.avmfritz.handler.BoxHandler.updateThingFromDevice(BoxHandler.java:165)[219:org.openhab.binding.avmfritz:2.0.0.201701091302]
        at org.openhab.binding.avmfritz.handler.BoxHandler.addDeviceList(BoxHandler.java:129)[219:org.openhab.binding.avmfritz:2.0.0.201701091302]
        at org.openhab.binding.avmfritz.internal.hardware.callbacks.FritzAhaUpdateXmlCallback.execute(FritzAhaUpdateXmlCallback.java:70)[219:org.openhab.binding.avmfritz:2.0.0.201701091302]
        at org.openhab.binding.avmfritz.internal.hardware.FritzahaContentExchange.onComplete(FritzahaContentExchange.java:71)[219:org.openhab.binding.avmfritz:2.0.0.201701091302]
        at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193)[69:org.eclipse.jetty.client:9.2.19.v20160908]

Looking into the code and increase the loglevel, I found no immediate problems. The response from the fritzbox, which is being converted, is:

<devicelist version="1">
  <device identifier="xxx" id="17" functionbitmask="896" fwversion="03.59" manufacturer="AVM" productname="FRITZ!DECT 200">
  <present>1</present>
  <name>AV Geräte</name>
  <switch><state>1</state><mode>manuell</mode><lock>1</lock></switch>
  <powermeter><power>29680</power><energy>1514500</energy></powermeter>
  <temperature><celsius>205</celsius><offset>0</offset></temperature>
</device>
...

However, the resulting DeviceModel instance is:

org.openhab.binding.avmfritz.internal.ahamodel.DeviceModel@1c33f7d[ain=xxx,bitmask=896,isDectRepeater=false,isPowermeter=true,isTempSensor=true,isSwitchableOutlet=true,id=17,manufacturer=AVM,productname=FRITZ!DECT 200,fwversion=03.59,present=1,name=AV Geräte,org.openhab.binding.avmfritz.internal.ahamodel.SwitchModel@dd851c[state=1,mode=manuell,lock=1],<null>,org.openhab.binding.avmfritz.internal.ahamodel.TemperatureModel@f130a5[celsius=20.5,offset=0.0]]

The import part here is the <null> for powermeter. But the instance is created by Jaxb, and nothing has changed here.

Before I open a new issue in GitHub: Does anybody has an idea?

Cheers,

Stephan

Ok, after the next update (today,2.0.0~20170112185728-1), it seems to work again…

Strange

And now its back…

Hey pauxus,

how fateful. I got the same situation since monday. The values for the powermeter channels “power” and “energy” of my DECT 200 devices suddenly didn’t update anymore. I couldn’t find the reason for that. But since I am using a newer .jar file I didn’t got those NPEs. After a restart of the openhab2.service the problem was gone and the values are shown nicely again. Maybe you should try that in the first place.

You are welcome to download and test the new version here.

Pull request #1815 will handle those NPEs.

greetings