UniFi Protect Binding (Cloudkey gen2+, Dream Machine Pro, NVR)

Are there any other errors before this happens? I can’t do much with that error, it states that auth is failing for whatever reason, could be network, could be the host it is running on, could be a firewall partially block some traffic.

If I understand you correctly it works for some time and then suddenly stops? Are the motion events working during this time?
Are you running openhab in docker?
Is openhab in the same network as the unifi stuff?
Any other network related errors?

I’m not sure. The log file is massive, and failed is a keyword that’s also used if channels or devices aren’t present… I searched for java… Do you have another suggestion?

Can you think of a way I could test this? I’ll take a screenshot of how my firewall situation looks like later today (the Unifi firewalls that is, maybe in Linux there’s something?).

I don’t know what stops working, since the motion events and such are still being transmitted.

No, on Linux Mint.

Yes.

Not that I know of…

Apart from that, I suppose the countless bootstrap files that are being created (more than 1500 since yesterday afternoon!) have another reason?

The binding stopped working again… Meanwhile, more than 4770 (!) bootstrap files have been created.

Update 21/10 6h40 CET (see below for a previous post - I’m unable to post again, so I have to edit):

A reboot later, everything went back to what it was. No error on startup, except this:

2024-10-20 20:21:38.248 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler UniFiProtectG5CameraThingHandler of thing unifiprotect:g5camera:f4b3b5f657:F4E2C676310A tried accessing its bridge although the handler was already disposed.

In the logs:

2024-10-20 22:21:56.341 [DEBUG] [otect.internal.model.UniFiProtectNvr] - Request failed reason: EXECUTION_FAULT message: Execution fault when sending request to UniFi Protect
java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
	at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118) ~[?:?]
	at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101) ~[?:?]
	at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:732) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.model.request.UniFiProtectRequest.sendRequestGetResponse(UniFiProtectRequest.java:170) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.model.request.UniFiProtectRequest.sendRequest(UniFiProtectRequest.java:121) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.model.UniFiProtectNvr.refreshBootstrap(UniFiProtectNvr.java:166) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.model.UniFiProtectNvr.refreshProtect(UniFiProtectNvr.java:223) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.refresh(UniFiProtectNvrThingHandler.java:206) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.run(UniFiProtectNvrThingHandler.java:170) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
	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:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:840) [?:?]
Caused by: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
	at org.eclipse.jetty.client.AuthenticationProtocolHandler$AuthenticationListener.onComplete(AuthenticationProtocolHandler.java:164) ~[?:?]
	at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:218) ~[?:?]
	at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:210) ~[?:?]
	at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:481) ~[?:?]
	at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:461) ~[?:?]
	at org.eclipse.jetty.client.HttpReceiver.responseSuccess(HttpReceiver.java:424) ~[?:?]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.messageComplete(HttpReceiverOverHTTP.java:374) ~[?:?]
	at org.eclipse.jetty.http.HttpParser.handleContentMessage(HttpParser.java:596) ~[?:?]
	at org.eclipse.jetty.http.HttpParser.parseContent(HttpParser.java:1723) ~[?:?]
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1552) ~[?:?]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:208) ~[?:?]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:148) ~[?:?]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:80) ~[?:?]
	at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:131) ~[?:?]
	at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:172) ~[?:?]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) ~[?:?]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) ~[?:?]
	at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:555) ~[?:?]
	at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:410) ~[?:?]
	at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:164) ~[?:?]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) ~[?:?]
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) ~[?:?]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) ~[?:?]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) ~[?:?]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) ~[?:?]
	... 1 more
2024-10-20 22:21:56.350 [DEBUG] [al.model.request.UniFiProtectRequest] - Response is null, it shouldn't be
2024-10-20 22:21:56.350 [DEBUG] [otect.internal.model.UniFiProtectNvr] - Credentials expired, logging in again

This repeats itself every 2 hours on the dot.

I checked the login credentials of the binding, they give access to everything on the Dream Router.


What happened 20/10 around 20h00 CET:

I eventually realized I do have a firewall rule preventing my devices from reaching out to other DNS servers than the two I created. I added the IP address of my camera to that rule (thus giving it the freedom to use whatever port it wants to the outside world), and now I get another error at startup:

19:33:30.369 [WARN ] [b.core.thing.binding.BaseThingHandler] - Handler UniFiProtectG5CameraThingHandler of thing unifiprotect:g5camera:f4b3b5f657:F4E2C676310A tried accessing its bridge although the handler was already disposed.

(This one was actually always there, but the next one is new)
&

19:34:31.928 [WARN ] [ommon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:
java.lang.NullPointerException: Cannot invoke "org.openhab.binding.unifiprotect.internal.event.UniFiProtectEventManager.stop()" because "this.eventManager" is null
        at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.refresh(UniFiProtectNvrThingHandler.java:208) ~[?:?]
        at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.run(UniFiProtectNvrThingHandler.java:170) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
        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:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.lang.Thread.run(Thread.java:840) [?:?]

In the logs, I see:

2024-10-20 19:33:30.318 [DEBUG] [al.model.request.UniFiProtectRequest] - >> POST https://192.168.1.1/api/auth/login
2024-10-20 19:33:30.323 [DEBUG] [otect.internal.model.UniFiProtectNvr] - Request failed reason: EXECUTION_FAULT message: Execution fault when sending request to UniFi Protect
java.util.concurrent.ExecutionException: java.net.ConnectException: Verbinding is geweigerd
	at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118) ~[bundleFile:9.4.54.v20240208]
	at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101) ~[bundleFile:9.4.54.v20240208]
	at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:732) ~[bundleFile:9.4.54.v20240208]
	at org.openhab.binding.unifiprotect.internal.model.request.UniFiProtectRequest.sendRequestGetResponse(UniFiProtectRequest.java:170) ~[bundleFile:?]
	at org.openhab.binding.unifiprotect.internal.model.request.UniFiProtectRequest.sendRequest(UniFiProtectRequest.java:121) ~[bundleFile:?]
	at org.openhab.binding.unifiprotect.internal.model.UniFiProtectNvr.login(UniFiProtectNvr.java:105) [bundleFile:?]
	at org.openhab.binding.unifiprotect.internal.model.UniFiProtectNvr.start(UniFiProtectNvr.java:241) [bundleFile:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.initialize(UniFiProtectNvrThingHandler.java:105) [bundleFile:?]
	at jdk.internal.reflect.GeneratedMethodAccessor41.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:569) ~[?:?]
	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) [?:?]
Caused by: java.net.ConnectException: Verbinding is geweigerd
	at sun.nio.ch.Net.pollConnect(Native Method) ~[?:?]
	at sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[?:?]
	at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:946) ~[?:?]
	at org.eclipse.jetty.io.SelectorManager.doFinishConnect(SelectorManager.java:355) ~[?:?]
	at org.eclipse.jetty.io.ManagedSelector.processConnect(ManagedSelector.java:347) ~[?:?]
	at org.eclipse.jetty.io.ManagedSelector.access$1700(ManagedSelector.java:65) ~[?:?]
	at org.eclipse.jetty.io.ManagedSelector$SelectorProducer.processSelected(ManagedSelector.java:676) ~[?:?]
	at org.eclipse.jetty.io.ManagedSelector$SelectorProducer.produce(ManagedSelector.java:535) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produceTask(EatWhatYouKill.java:362) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:186) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:137) ~[?:?]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) ~[?:?]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) ~[?:?]
	... 1 more
2024-10-20 19:33:30.341 [DEBUG] [al.thing.UniFiProtectNvrThingHandler] - Scheduling refresh job every 60s
2024-10-20 19:33:30.343 [ERROR] [al.thing.UniFiProtectNvrThingHandler] - UniFiProtect Offline due to failuer: Execution fault when sending request to UniFi Protect
java.util.concurrent.ExecutionException: java.net.ConnectException: Verbinding is geweigerd
	at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118) ~[bundleFile:9.4.54.v20240208]
	at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101) ~[bundleFile:9.4.54.v20240208]
	at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:732) ~[bundleFile:9.4.54.v20240208]
	at org.openhab.binding.unifiprotect.internal.model.request.UniFiProtectRequest.sendRequestGetResponse(UniFiProtectRequest.java:170) ~[bundleFile:?]
	at org.openhab.binding.unifiprotect.internal.model.request.UniFiProtectRequest.sendRequest(UniFiProtectRequest.java:121) ~[bundleFile:?]
	at org.openhab.binding.unifiprotect.internal.model.UniFiProtectNvr.login(UniFiProtectNvr.java:105) ~[bundleFile:?]
	at org.openhab.binding.unifiprotect.internal.model.UniFiProtectNvr.start(UniFiProtectNvr.java:241) ~[bundleFile:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.initialize(UniFiProtectNvrThingHandler.java:105) [bundleFile:?]
	at jdk.internal.reflect.GeneratedMethodAccessor41.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:569) ~[?:?]
	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) [?:?]
Caused by: java.net.ConnectException: Verbinding is geweigerd
	at sun.nio.ch.Net.pollConnect(Native Method) ~[?:?]
	at sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[?:?]
	at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:946) ~[?:?]
	at org.eclipse.jetty.io.SelectorManager.doFinishConnect(SelectorManager.java:355) ~[?:?]
	at org.eclipse.jetty.io.ManagedSelector.processConnect(ManagedSelector.java:347) ~[?:?]
	at org.eclipse.jetty.io.ManagedSelector.access$1700(ManagedSelector.java:65) ~[?:?]
	at org.eclipse.jetty.io.ManagedSelector$SelectorProducer.processSelected(ManagedSelector.java:676) ~[?:?]
	at org.eclipse.jetty.io.ManagedSelector$SelectorProducer.produce(ManagedSelector.java:535) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produceTask(EatWhatYouKill.java:362) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:186) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:137) ~[?:?]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) ~[?:?]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) ~[?:?]
	... 1 more
2024-10-20 19:33:30.379 [DEBUG] [ing.UniFiProtectG5CameraThingHandler] - Initializing G5 Camera name: Not initialized type: Not initialized
2024-10-20 19:33:31.049 [DEBUG] [al.thing.UniFiProtectNvrThingHandler] - Executing refresh job
2024-10-20 19:33:31.050 [DEBUG] [al.thing.UniFiProtectNvrThingHandler] - Refreshing Protect: 1163965694
2024-10-20 19:33:31.051 [DEBUG] [al.thing.UniFiProtectNvrThingHandler] - Refreshing the UniFi Protect Controller unifiprotect:nvr:f4b3b5f657
2024-10-20 19:33:31.054 [DEBUG] [al.model.request.UniFiProtectRequest] - Set json Body: {"remember":false,"password":"vuayc-9gomsAWeN@ByQc","rememberMe":false,"strict":false,"username":"openhab","token":null}
2024-10-20 19:33:31.054 [DEBUG] [al.model.request.UniFiProtectRequest] - Created new request host: 192.168.1.1, scheme: https, path: /api/auth/login
2024-10-20 19:33:31.054 [DEBUG] [al.model.request.UniFiProtectRequest] - New request: HttpRequest[POST /api/auth/login HTTP/1.1]@62df7936
2024-10-20 19:33:31.054 [DEBUG] [al.model.request.UniFiProtectRequest] - >> POST https://192.168.1.1/api/auth/login
2024-10-20 19:33:31.056 [DEBUG] [otect.internal.model.UniFiProtectNvr] - Request failed reason: EXECUTION_FAULT message: Execution fault when sending request to UniFi Protect
java.util.concurrent.ExecutionException: java.net.ConnectException: Verbinding is geweigerd
	at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118) ~[?:?]
	at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101) ~[?:?]
	at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:732) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.model.request.UniFiProtectRequest.sendRequestGetResponse(UniFiProtectRequest.java:170) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.model.request.UniFiProtectRequest.sendRequest(UniFiProtectRequest.java:121) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.model.UniFiProtectNvr.login(UniFiProtectNvr.java:105) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.model.UniFiProtectNvr.refreshProtect(UniFiProtectNvr.java:214) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.refresh(UniFiProtectNvrThingHandler.java:206) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.run(UniFiProtectNvrThingHandler.java:170) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
	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:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:840) [?:?]
Caused by: java.net.ConnectException: Verbinding is geweigerd
	at sun.nio.ch.Net.pollConnect(Native Method) ~[?:?]
	at sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[?:?]
	at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:946) ~[?:?]
	at org.eclipse.jetty.io.SelectorManager.doFinishConnect(SelectorManager.java:355) ~[?:?]
	at org.eclipse.jetty.io.ManagedSelector.processConnect(ManagedSelector.java:347) ~[?:?]
	at org.eclipse.jetty.io.ManagedSelector.access$1700(ManagedSelector.java:65) ~[?:?]
	at org.eclipse.jetty.io.ManagedSelector$SelectorProducer.processSelected(ManagedSelector.java:676) ~[?:?]
	at org.eclipse.jetty.io.ManagedSelector$SelectorProducer.produce(ManagedSelector.java:535) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produceTask(EatWhatYouKill.java:362) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:186) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:137) ~[?:?]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) ~[?:?]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) ~[?:?]
	... 1 more
2024-10-20 19:33:31.058 [ERROR] [otect.internal.model.UniFiProtectNvr] - Failed to updated Cameras since we can't seem to login status: EXECUTION_FAULT
2024-10-20 19:33:31.059 [DEBUG] [otect.internal.model.UniFiProtectNvr] - Status message: Execution fault when sending request to UniFi Protect exception: java.util.concurrent.ExecutionException: java.net.ConnectException: Verbinding is geweigerd
2024-10-20 19:34:31.059 [DEBUG] [al.thing.UniFiProtectNvrThingHandler] - Executing refresh job
2024-10-20 19:34:31.059 [DEBUG] [al.thing.UniFiProtectNvrThingHandler] - Refreshing Protect: 1163965694
2024-10-20 19:34:31.059 [DEBUG] [al.thing.UniFiProtectNvrThingHandler] - Refreshing the UniFi Protect Controller unifiprotect:nvr:f4b3b5f657
2024-10-20 19:34:31.060 [DEBUG] [al.model.request.UniFiProtectRequest] - Set json Body: {"remember":false,"password":"vuayc-9gomsAWeN@ByQc","rememberMe":false,"strict":false,"username":"openhab","token":null}
2024-10-20 19:34:31.060 [DEBUG] [al.model.request.UniFiProtectRequest] - Created new request host: 192.168.1.1, scheme: https, path: /api/auth/login
2024-10-20 19:34:31.060 [DEBUG] [al.model.request.UniFiProtectRequest] - New request: HttpRequest[POST /api/auth/login HTTP/1.1]@13f7b69f
2024-10-20 19:34:31.061 [DEBUG] [al.model.request.UniFiProtectRequest] - >> POST https://192.168.1.1/api/auth/login
2024-10-20 19:34:31.911 [DEBUG] [otect.internal.model.UniFiProtectNvr] - Successfullt sent request
2024-10-20 19:34:31.913 [DEBUG] [al.model.request.UniFiProtectRequest] - Key: x-csrf-token, value: 74e190ff-59de-43fd-847c-ca66d2ce3880
2024-10-20 19:34:31.914 [DEBUG] [al.model.request.UniFiProtectRequest] - Created new request host: 192.168.1.1, scheme: https, path: /proxy/protect/api/bootstrap
2024-10-20 19:34:31.914 [DEBUG] [al.model.request.UniFiProtectRequest] - New request: HttpRequest[GET /proxy/protect/api/bootstrap HTTP/1.1]@5a0e7fb0
2024-10-20 19:34:31.914 [DEBUG] [al.model.request.UniFiProtectRequest] - >> GET https://192.168.1.1/proxy/protect/api/bootstrap
2024-10-20 19:34:31.918 [DEBUG] [otect.internal.model.UniFiProtectNvr] - Successfullt sent request
2024-10-20 19:34:31.918 [DEBUG] [otect.internal.model.UniFiProtectNvr] - Request is ok, parsing cameras
2024-10-20 19:34:31.919 [ERROR] [al.model.json.UniFiProtectJsonParser] - Failed to parse bootstrap json
2024-10-20 19:34:31.919 [DEBUG] [al.model.json.UniFiProtectJsonParser] - Failed to parse bootstrap json: <!doctype html><html lang="en"><head><meta charset="utf-8"><link rel="icon" href="/favicon.ico?v3" sizes="any"><link rel="icon" href="/favicon.svg?v3" type="image/svg+xml"><link rel="apple-touch-icon" href="/apple-touch-icon.png?v3"><title>UniFi OS</title><meta name="viewport" content="width=device-width,initial-scale=1"><script>window.UNIFI_OS_MANIFEST = {"model":{"id":"UDR","shortName":"UDR","longName":"UniFi Dream Router"},"images":[{"size":1024,"url":"/assets/images/1024.png?udr-3.0.0"},{"size":64,"url":"/assets/images/64.png?udr-3.0.0"},{"size":48,"url":"/assets/images/48.png?udr-3.0.0"}]}</script><script defer="defer" src="/main.0178b959830932983dec.js"></script><link href="/main.6bc650de.css" rel="stylesheet"></head><body id="portal-body"><div id="portal-root"></div></body></html>
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $
	at com.google.gson.JsonParser.parseReader(JsonParser.java:76) ~[?:?]
	at com.google.gson.JsonParser.parseString(JsonParser.java:51) ~[?:?]
	at com.google.gson.JsonParser.parse(JsonParser.java:115) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.model.json.UniFiProtectJsonParser.parseJson(UniFiProtectJsonParser.java:78) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.model.json.UniFiProtectJsonParser.parseBootstrap(UniFiProtectJsonParser.java:68) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.model.UniFiProtectNvr.refreshBootstrap(UniFiProtectNvr.java:117) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.model.UniFiProtectNvr.refreshBootstrap(UniFiProtectNvr.java:185) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.model.UniFiProtectNvr.refreshProtect(UniFiProtectNvr.java:223) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.refresh(UniFiProtectNvrThingHandler.java:206) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.run(UniFiProtectNvrThingHandler.java:170) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
	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:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:840) [?:?]
Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $
	at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1659) ~[?:?]
	at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1465) ~[?:?]
	at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:551) ~[?:?]
	at com.google.gson.stream.JsonReader.peek(JsonReader.java:433) ~[?:?]
	at com.google.gson.JsonParser.parseReader(JsonParser.java:71) ~[?:?]
	... 15 more
2024-10-20 19:34:31.926 [DEBUG] [ifiprotect.internal.UniFiProtectUtil] - Wrote file: /var/lib/openhab/tmp/bootstrap11375889675583845955.json
2024-10-20 19:34:31.926 [DEBUG] [otect.internal.model.UniFiProtectNvr] - Wrote bootstrap to temp file: /var/lib/openhab/tmp/bootstrap11375889675583845955.json

The binding works again - for now. (I don’t really understand how that is possible with a ‘refused connection’, but who am I :slight_smile:.)

Hi, is anyone able to get the binding to work with a G5 camera?

Once I create the thing for a G5 camera, everything looks fine with a nice “online” status but when I try create an item to link it to a channel (via the UI), the item does not get updated - even the simplest ones like type etc…

I too get the warning of the handler having been already disposed…

Versions:
openhab 4.1.2
Unifi Protect Binding : 4.0.0.202410141758

Unifi OS : 4.1.11
Protect : 5.1.85

Thanks in advance for any hint.

I have a G5 PTZ connected and that works fine. Use only 1 item to set recording mode. Just to make sure: you do have the NVR Thing as a bridge, I assume?!

Thanks for the confirmation that you have a g5 camera well managed by the binding.

Yes, I have the right bridge connected to the NVR thing.
Also, the NVR thing is properly connected and I have a few items that are updating properly… I have also a g3camera that is properly coupled in openhab…

@Seaside, is the binding in the add-on store (4.3.1) the most recent version? There hasn’t been a new jar since the release of 4.3.1, but I’m not 100 % sure I understand how binding development works. (Or the development of the Unifi Protect binding in particular.)

Update on my side…

My need was to be able to trigger events from the camera’s motion detections (to turn on lights and other things)…
Instead of relying on the binding, I temporarily rely on the webhook provided by Protect (in Alarms Manager). This way I can trigger openhab and get going.
It is not ideal as it distributes a bit too much the logic accross different worlds, but it does what I need for the time being.

I’m still not sure of what is happening… I can’t get any of the items associated to channels of the G5 camera to update properly (not even once), while the thing associated with the camera itself is showing “online”…

Will there be an Update for the NFC/Fingerprint feature of the G4 Doorbell Pro?

Would it be possible to provide a channel/item with the url for the rtsps-stream so that the item can be used for video widget in mainUI?

I don’t have the G4 Doorbell Pro myself so not sure how the feature work. It is possible to if you send me the bootstrap.xml or possibly can check from UniFi main-ui how the api is called when unlocking. Otherwise I would not be able to add it.

Yes that is possible. I have on purpose not exposed any rtsps stuff, but could possibly reconsider. You can still use the IP-Camera binding in parallel with this binding where this is possible. It is also possible to just add your own item with the rtsp link (Link is available in the main unifi protect ui when you enable rtsp

1 Like

Is it working with any other camera ? (G4 or G3)

Not sure, problem is that the addon store does not seem to handle when the jar is changed, unless the filename is changed. I have used the same filename for long. Will in future releases use a new filename each time, but if you want to be sure download latest release from github and compare.

It would be great, if you could add this.
I already tried to do it with the ip cam binding, but without success (already posted the issue on the ip cam binding thread).
If the stream was available from protect binding, i could remove the ip cam binding.

Thing ipcamera:generic:front_camera "front camera" [ 
  mjpegOptions="-q:v 5 -r 2 -vf scale=640:-2 -update 1",
  ipAddress="192.168.1.1",
  updateImageWhen="1",
  mjpegUrl="ffmpeg",
  gifPreroll=0,
  ffmpegLocation="/usr/bin/ffmpeg",
  ipWhitelist="DISABLE",
  mp4OutOptions="-c:v copy -c:a copy",
  pollTime=8000,
  port=7447,
  snapshotUrl="ffmpeg",
  snapshotOptions="-an -vsync vfr -q:v 2 -update 1",
  ffmpegInput="rtsp://192.168.1.1:7447/LxZniwZVZWbGrd2E",
  hlsOutOptions="-strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy -hls_flags delete_segments -hls_time 2 -hls_list_size 4",
  gifOutOptions="-r 2 -filter_complex scale=-2:360:flags=lanczos,setpts=0.5*PTS,split[o1][o2];[o1]palettegen[p];[o2]fifo[o3];[o3][p]paletteuse"
]

this LxZniwZVZWbGrd2E is actually in the link that is generated in the ui of protect when you enable the stream of the camera

Thanks for that, but it does not work at my setup (i changed the port and the url to my stream).
The thing could be created, then i added items for HLS and MJPEG, but both dont work with the video cell at main ui:

The media could not be loaded, either because the server or network failed or because the format is not supported.```

dont change the port in the ui of unifi i get this link rtsps://192.168.1.1:7441/LxZniwZVZWbGrd2E?enableSrtp see what i mean ?

then this are my items

String g_outside_front_camera_Image_URL  { channel="ipcamera:generic:front_camera:imageUrl" }
String gg_outside_front_camera_MJPEG_URL  { channel="ipcamera:generic:front_camera:mjpegUrl" }
Switch g_outside_front_camera_Image_URL_pool { channel="ipcamera:generic:front_camera:pollImage" }

and there i get a url like http://192.168.1.100:8080/ipcamera/front_camera/ipcamera.mjpeg

In this URL i get the port 7441 instead of 7447

rtsps://192.168.1.1:7441/xxxxx?enableSrtp

so i changed “port” from 7447 to 7441 and used the url of my protect ui