Problem with Zoneminder binding on OH4

Hello,

on my updated OH4 instance my zoneminder binding does not work any moore.
I get the following error in the logs:

14:27:34.396 [INFO ] [.core.thing.internal.ThingManagerImpl] - Updating 'zoneminder:server:Zoneminder_Server01' from version 0 to 1
14:27:34.397 [ERROR] [.internal.JSONResponseExceptionMapper] - Unexpected exception occurred while processing REST request.
java.lang.IllegalArgumentException: Provider for thing zoneminder:server:Zoneminder_Server01 cannot be determined because it is not known to the registry
	at org.openhab.core.thing.internal.ThingManagerImpl.thingUpdated(ThingManagerImpl.java:243) ~[?:?]
	at org.openhab.core.thing.internal.ThingManagerImpl.checkAndPerformUpdate(ThingManagerImpl.java:1100) ~[?:?]
	at org.openhab.core.thing.internal.ThingManagerImpl.registerAndInitializeHandler(ThingManagerImpl.java:917) ~[?:?]
	at org.openhab.core.thing.internal.ThingManagerImpl.setEnabled(ThingManagerImpl.java:1008) ~[?:?]
	at org.openhab.core.io.rest.core.internal.thing.ThingResource.setEnabled(ThingResource.java:608) ~[?:?]
	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.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) ~[bundleFile:3.4.5]
	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) ~[bundleFile:3.4.5]
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:201) ~[bundleFile:3.4.5]
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104) ~[bundleFile:3.4.5]
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) ~[bundleFile:3.4.5]
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) ~[bundleFile:3.4.5]
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:298) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPut(AbstractHTTPServlet.java:234) ~[bundleFile:3.4.5]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:520) ~[bundleFile:4.0.4]
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:273) ~[bundleFile:3.4.5]
	at org.ops4j.pax.web.service.spi.servlet.OsgiInitializedServlet.service(OsgiInitializedServlet.java:102) ~[bundleFile:?]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1656) ~[bundleFile:9.4.50.v20221201]
	at org.ops4j.pax.web.service.spi.servlet.OsgiFilterChain.doFilter(OsgiFilterChain.java:100) ~[bundleFile:?]
	at org.ops4j.pax.web.service.jetty.internal.PaxWebServletHandler.doHandle(PaxWebServletHandler.java:310) ~[bundleFile:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234) ~[bundleFile:9.4.50.v20221201]
	at org.ops4j.pax.web.service.jetty.internal.PrioritizedHandlerCollection.handle(PrioritizedHandlerCollection.java:96) ~[bundleFile:?]
	at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:722) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:555) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:410) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:164) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) ~[bundleFile:9.4.50.v20221201]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) ~[bundleFile:9.4.50.v20221201]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]

Any ideas?

Thanks for your help!

Alex

1 Like

I don’t know if it will help but did you clear the cache ?

Thanks for your reply - cleaning the cache i tried already.

I don’t remember if I had the same issue, but after the upgrade my zoneminder bridge wouldn’t work anymore.
I had to delete the bridge and recreate it.
I reassociated my monitor things with the new bridge and now, my devices are all online.

1 Like

Thanks, it worked.

Just tried to delete the bridge and recreate it still get an error:

Can't get version information

Openhab server:

Openhab 4.0.2
Zoneminder binding is 4.0.2
Rocky Linux 8.8
Java 17.0.8

Zoneminder server:

Zoneminder is 1.36.33
Rocky Linux 8.8

ZM is using https on the standard 443 port. They’re both working just fine but I can’t get openhab to talk to zoneminder.

I did try clearing cache. Also deleted the bridge thing, uninstalled the binding, shutdown openhab, cleared cache again, started openhab, installed ZM binding and added the bridge again. Still getting the same error.

ADDED:

I turned on debug for the binding and see this in the openhab.log:

2023-08-26 08:34:15.203 [DEBUG] [der.internal.handler.ZmBridgeHandler] - Bridge: Background discovery is ENABLED
2023-08-26 08:34:15.204 [DEBUG] [g.zoneminder.internal.handler.ZmAuth] - ZmAuth: Authorization is enabled
2023-08-26 08:34:15.205 [DEBUG] [der.internal.handler.ZmBridgeHandler] - Bridge: Checking for valid Zoneminder host: 10.10.100.100
2023-08-26 08:34:15.206 [DEBUG] [g.zoneminder.internal.handler.ZmAuth] - ZmAuth: Update expired REFRESH token using url 'https://10.10.100.100:443/zm/api/host/login.json'
2023-08-26 08:34:15.229 [DEBUG] [der.internal.handler.ZmBridgeHandler] - Bridge: IOException on POST request, url='https://10.10.100.100:443/zm/api/host/login.json': java.util.concurrent.ExecutionException: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Your issue seems linked with HTTPS/SSL.
I don’t know why openHAB 4 / zoneminder binding is more touchy than before, but four options are on the table :

  • someone changes zoneminder binding and add an option to trust all certificates. Requires someone willing to put time in dev. I don’t know if it is still actively maitained, though ?
  • fight with java keystore to import your custom public certificate, use it with openHAB, etc. You will find information on internet but if you hope 5 minutes and a few command line, I can take a bet that it won’t be this easy. There is ALWAYS something in the way :sweat_smile:
  • use a let’s encrypt certificate for your zoneminder or (better) for a reverse proxy (must be exposed on the internet). Again, not so easy, but it could be interesting if you want to check zoneminder from outside.
  • very easy route : dump HTTPS and use HTTP

I choosed the very easy route. Many experts will tell you that using HTTP is a bad idea. But frankly, if someone is inside my network spying my communication, HTTP or HTTPS will be the least of my worries.

fight with java keystore to import your custom public certificate, use it with openHAB, etc. You will find information on internet but if you hope 5 minutes and a few command line, I can take a bet that it won’t be this easy. There is ALWAYS something in the way :sweat_smile:

Been fighting this for a bit now. I’m no stranger to command line so I thought this might be the best solution. Ran keytool and got the cert added but can’t get past the “Can’t get version information” error.

When I get some time I think I’m gonna head down the let’s encrypt path.

Got a let’s encrypt cert working and after fiddling around with various auth and api settings I finally have my zoneminder server working as a bridge in Openhab.

I haven’t looked too much into it as yet, but it appears that whatever was working for a separate CA in V3 of Openhab no longer works. I’m in the process of re-establishing my Openhab (and zoneminder!) setups and adding my CA cert into the keystore as a CA used to sort that out.
This doesn’t work any more, I’ve got new certs, both issued by my CA to ZM and openhab, but openhab won’t connect using https. Symptom was the same on my previously running V3 install (which did recognise ZM via https), once it upgraded to V4 it stopped behaving itself.

A let’s encrypt cert on my zoneminder setup got the bridge working for me. I also have the monitors working but can’t seem to setup image or video URL items/links to use them on a page. Pretty sure I’m just doing it wrong or missing a step in the workflow. Still banging away with it though.

BTW, I have started working up some notes on getting zoneminder and openhab working with each other on the Zoneminder Wiki.

https://wiki.zoneminder.com/OpenhabWiki: Openhab

1 Like

Did a bit of investigation, it used to be possible to add the CA root cert as ca in the specific openhab keystore. Now the CA root cert must be added to the relevant Java cacerts keystore instead.

Think I found why I’m not getting good links to ZM image or video.

When I add an item for a video URL I end up with:

https://hostname:443/zm/cgi-bin/zms?mode=jpeg&monitor=100&token=<token>

The path appears to be incorrect. I can watch the feed using this:

https://hostname:443/cgi-bin-zm/nph-zms?scale=50&mode=jpeg&monitor=100&token=<token>

So how do I adjust the URL so it’s got the correct cgi-bin path? I can’t find anyplace to edit that.

I suspect that’s related to Zoneminder, and how it configures Apache for the specific distribution. I recall seeing that cgi-bin-zm path when I was using CentOS for my zoneminder install but it’s now /zm/cgi-bin/ with my ubuntu install. Config files are likely available somewhere like /etc/apache2/conf-enabled or similar on the ZM install. I suspect that upgrades may break it though.