New Zoneminder Binding for Zoneminder versions >= 1.34.0

Ok, good to know. I doubt there will be any side effects, since the change was pretty localized. But, let me know, nonetheless.

I’ll submit this change for inclusion in 3.2.

FTR, here’s the change I just submitted.

1 Like

I have upgraded my Zoneminder server to version 1.34.11 and now get this error.

image

I’ve not setup any logging for the binding as it just worked, can someone confirm the config details to enable logging of the binding so I can provide more details.

Is ZoneMinder of a different server from openHAB? If so, that error usually is indicative of a connectivity issue between the server running openHAB and the server running ZoneMinder.

An easy initial test is to try to access the ZoneMinder version URL from the command line on the openHAB server.

curl http://your.zoneminder.server/zm/api/host/getVersion.json

That should result in a response that looks like this:

{"version":"1.34.22","apiversion":"2.0"}

Can you give this a try?

Sorted, I’ll get my coat and leave. :smiley:

I’d changed the name of my Zoneminder server as part of the upgrade (long story) and not updated the Thing with the new hostname. Proper school boy error. All working once again, thanks for the reply.

1 Like

Happens to the best of us. :laughing:

I have found a genuine issue this time. :smiley:

I have a multi server setup for Zoneminder, mainly because I like the approach and due to running on VMWare so have limited vCPU’s available. But it all works great and I recommend it for those who like to play around.

With my setup I have created a number of Bridges, one for each Zoneminder server. But have also trying using just a single bridge against one of the servers.

The issue I have found is that after a few days the Zoneminder server stops responding at the GUI and neither restarting Zoneminder or Apache resolve the problem and a reboot is required. Which is a little annoying, but a work around is to schedule a reboot every few days. This is not ideal as you can miss something at the time of the reboot.

Looking at the logs on my Zoneminder servers I’ve found this one, which seems to be related. The 192.168.20.41 address is my openhab instance.

my-ll-zm05 http_error [Thu Dec 09 01:45:46.983517 2021] [proxy_fcgi:error] [pid 33250:tid 139897805461248] (70007)The timeout specified has expired: [client 192.168.20.41:45320] AH01075: Error dispatching request to : (polling)

This is the corresponding error on my openhab server.

2021-12-09 01:45:41.950 [DEBUG] [der.internal.handler.ZmBridgeHandler] - Bridge: IOException on GET request, url='http://my-ll-zm05.cctv.mycyberspace.net/zm/api/monitors.json?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJab25lTWluZGVyIiwiaWF0IjoxNjM5MDEyNjY4LCJleHAiOjE2MzkwMTk4NjgsInVzZXIiOiJvcGVuaGFiIiwidHlwZSI6ImFjY2VzcyJ9.9ICwGnlZPRZAp9HXBoCnLeWc7j7u3Xfgyx_vaYT6zcM': java.util.concurrent.TimeoutException: Total timeout 10000 ms elapsed

It’s pretty odd that a restart of ZoneMinder would not fix the problem. That suggests to me the server running ZoneMinder is getting itself into a pretty corrupt state. I’m not sure what to say about that except to suggest that you make sure the server running ZoneMinder has enough memory, swap, etc. to handle the extra load from handling the API calls.

Feature Request/Idea

Not sure if this is right place or not. But It would be nice to have the Zoneminder binding optionally scale/compress the image items. This would be great for thumbnails and not eat up a ton of heap in Openhab. I have 24 2/4k cameras and if I enable raw image items it will eat up heap like crazy. Using the image URL is also bandwidth intensive, I have 8 Habpanel displays which pull these down and scale them locally for overview thumbnails.

This way a widget can be made to use lowres image item for regular updates, then if there is a motion or alert event the widget can switch to a high res imageURL, or VideoURL.

Thanks

Just wondering if you can accomplish this using ZoneMinder by creating additional low resolution and fps monitors. I realize 24 would be a lot of additional monitors, but they likely wouldn’t add too much overhead if set up for low resolution and low fps.

I thought about this, it just would get messy, and I’m already at memory limits for the the box. I would have to add additional memory, The server I use for Zoneminder is a Xeon that requires ECC UDIMMS which are quite pricey. If I went down that path I would end up replacing the entire server with something new.

Have you looked at the ipcamera binding? You might be able to meet your requirements using a secondary low-res channel on your cameras feeding into the ipcamera binding. IMHO, adding image processing functionality into the ZoneMinder binding looks like a whole extra layer of complexity and I doubt it would be a simple job to implement.

That’s a good suggestion.

True that! Adding image processing into the ZoneMinder binding is not anywhere near my radar screen. :wink:

Actually this is not a bad idea. I think I’ll try this out. Thanks.

Been busy with work for the past few weeks and have just got back to looking at my issue. Here’s an entry from the logs.

2021-12-23 17:49:26.553 [DEBUG] [der.internal.handler.ZmBridgeHandler] - Bridge: IOException on GET request, url='http://my-ll-zm01.cctv.mycyberspace.net/zm/api/monitors.json?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJab25lTWluZGVyIiwiaWF0IjoxNjQwMjgxNzU2LCJleHAiOjE2NDAyODg5NTYsInVzZXIiOiJvcGVuaGFiIiwidHlwZSI6ImFjY2VzcyJ9.DUpa_DkrzwF8rya4kAMS9q0jHkzbJrdOQobIA2xG28g': java.util.concurrent.ExecutionException: java.io.EOFException: HttpConnectionOverHTTP@76947c2::SocketChannelEndPoint@4b76dbeb{l=/192.168.20.41:40324,r=my-ll-zm01.cctv.mycyberspace.net/192.168.3.1:80,ISHUT,fill=-,flush=-,to=0/0}{io=1/0,kio=1,kro=1}->HttpConnectionOverHTTP@76947c2(l:/192.168.20.41:40324 <-> r:my-ll-zm01.cctv.mycyberspace.net/192.168.3.1:80,closed=false)=>HttpChannelOverHTTP@3e838482(exchange=HttpExchange@34fe61ed{req=HttpRequest[GET /zm/api/monitors.json HTTP/1.1]@796477e7[TERMINATED/null] res=HttpResponse[null 0 null]@43052a3[PENDING/null]})[send=HttpSenderOverHTTP@26b57133(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator@61039d01{s=START}],recv=HttpReceiverOverHTTP@3b821589(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,0 of -1}]]

Hopefully @mhilbush this means something to you. For information I’m running version 3.2.0 and Zoneminder 1.36.11

I’ve deleted the bridge and re-created as a just in case and that’s not helped. If I open the url in a browser I get a full list of details about all my cameras.

1 Like

Unfortunately, I have no idea what’s going on.

@mhilbush , do you know if it’s feasible to activate/deactivate zones in Zoneminder monitors from the binding? I have a camera with motion detection in three zones, two of the zones barely give any false positives. The third works fine during daylight but gets triggered by car headlights at night. It would be neat if I could turn off that zone when it’s dark.

Just throwing the idea out there :slight_smile:

I’m not completely sure if it’s possible. Generally, anything you can do through the web UI, you also can do through the API.

I do see there’s a way to retrieve the list of zones.
http://path.to.your.zoneminder/zm/api/zones.json

But, I’m not sure what the API is to enable or disable a zone. As I don’t use zones, would you happen to know how to enable/disable a zone in the UI? Is it the Type field in the zone?

Yes, it’s the Type field, usually it’s set to Active but can also be set to Inactive. Incidentally, the Privacy status is also useful to blank out parts of a camera feed that you don’t want to record.

So, this will make a zone 1 inactive.

curl -XPOST http://path.to.your.zoneminder/zm/api/zones/1.json -d "Zone[Type]=Inactive"

And active.

curl -XPOST http://path.to.your.zoneminder/zm/api/zones/1.json -d "Zone[Type]=Active"

If you wanted to do this in a rule, you probably could just use the sendHttpPostRequest action.