seaside1 / unifiprotect

openHAB UniFi Protect Addon
Eclipse Public License 2.0
21 stars 6 forks source link

NPE after restarting UnifiProtect binding #5

Closed jshatch closed 3 years ago

jshatch commented 3 years ago

Upon initial configuration of the Unifi CK G2+ and the G4 Doorbell I was able to see the button press event happen and everything was working fine. Then I restarted openhab and now I get this in the log and I get no more button press events showing up:

2021-03-30 11:19:52.791 [INFO ] [otect.internal.model.UniFiProtectNvr] - Initializing the binding, with config: UniFiProtectNvrThingConfig [host=unifi, username=openhab, password=*************, refresh=60, eventsTimePeriodLength=30, thumbnailWidth=640.0, imageFolder=/var/lib/openhab/tmp, g4SnapshotWidth=3840, g4SnapshotHeight=2160, defaultSnapshotWidth=1920, defaultSnapshotHeight=1080, g4SnapshotWidthAsString=3840, g4SnapshotHeightAsString=2160, defaultSnapshotWidthAsString=1920, defaultSnapshotHeightAsString=1080]
2021-03-30 11:20:54.105 [ERROR] [otect.internal.model.UniFiProtectNvr] - Could not find any valid user. Looking for: openhab
java.lang.NullPointerException: null
        at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.refreshChannel(UniFiProtectNvrThingHandler.java:306) ~[?:?]
        at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.refreshNvrChannels(UniFiProtectNvrThingHandler.java:226) ~[?:?]
        at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.refresh(UniFiProtectNvrThingHandler.java:204) ~[?:?]
        at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.run(UniFiProtectNvrThingHandler.java:166) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]
jshatch commented 3 years ago

I can actually get the same behavior by disabling and enabling the thing itself. Restarting the service isn't necessary.

jshatch commented 3 years ago

I re-setup everything and I can no longer replicate this problem. It was probably an issue on my end.