Zoneminder binding

Did a reinstall of the zoneminder-binding and kept the /zm path config. That worked.

Noticed that disk usage is reported in actual GB rather then %. Is that correct? Would prefer %

I found a solution for me with the apc_fetch() / API error.
Checkout your apache error log /var/log/apache2/error.log.
See if there is something that says:

 PHP Fatal error:  Call to undefined function apc_fetch() in /usr/share/php/Cake/

Also, check if you can access the zm API: (Zoneminder API Documentation)

Type this in your Browser after you logged on to your zoneminder:

http://your-server-ip/zm/api/host/getVersion.json

If you got an http error 500, the api is not working.

So if this is true, check your PHP Version.
In my case, i was running on 5.6, but also got 7.0 installed but not activated.
But all important php modules (like ACPU, APC) where activated in the 7.0 config :man_facepalming:. (howto install acpu)
To switch to php 7.0 do the following in your shell:

a2dismod php5
a2enmod php7.0
service apache2 restart

After that, the Zoneminder API starts working fine.

Good luck!
:slight_smile:

This post is a few years old, but whats the latest with this binding?

I installed the binding in OH2.2, added the ZM server and all the items auto discovered. WOW.

I tried to create a rule to turn on a light if an alarm (motion) is triggered, but I could not get it work.

Is this supported or does my newbie skills need more work?

thx

binding works perfectly - please share your items/rules

Well its working perfectly today, dont understand why it wasn’t working last night. I created the rules in paperui, not sure where to find the actual rules. In the log file Im seeing all my cameras sending motion triggers now.

2017-12-23 10:37:48.589 [vent.ItemStateChangedEvent] - zoneminder_monitor_94da2af1_monitor_2_alarm changed from OFF to ON

I suggest you start with the samples here.
This should give you a good starting point. If you create a rule that triggers on the alarm channel for monitor 1 in the sample it would be the Item called zmMonitor1_EventState.
Hope that clearifies things


Sorry for the late answer :blush:

Got around to playing with the binding, and found (one of) the reason for “refreshThing()” failing with a NPE, as reported on a few occasions (see for example ZoneMinder Binding: Method ‘refreshThing()’ for Bridge failed for thing)

When using ZM 1.29, that version doesn’t support the “http://zm:80/zm/api/monitors/alarm/id:11/command:status.json” alarm status API. The zoneminder4j library (used by the binding) has a bug in ‘ZoneMinderMonitorProxy.getMonitorDetailedStatus()’ in that it attempts to access the status object, which is null, and thus creates a NPE. The exception prevents any other data points in that zm monitor to be updated.

I’ve created a fix, which is here: https://github.com/HentschelT/zoneminder4j/blob/8afab308319987e5570cf64ee501df7bdc0fa2bc/zoneminder4j/src/main/java/name/eskildsen/zoneminder/internal/ZoneMinderMonitorProxy.java#L293 , which made the binding work for me.

One problem I encountered is that the zoneminder4j repo (https://github.com/Mr-Eskildsen/zoneminder4j) doesn’t appear up to date, it wants to build version 0.9.4, but the OHAB2 plugin has version 0.9.7 of the jar. There is also API’s missing in 0.9.4, which I stubbed out for testing. I’d assume there are other things that are missing too.

@mr_eskildsen : any chance you could update the zoneminder4j repo to what’s used in the OHAB2 binding?

Cheers,
-Th

1 Like

Sure. Actually I have given it a general overhaul last year. Unfortunately I havn’t committed things yet, I had planned to do the final stuff in the Zoneminder Binding in my christmas holiday. Unfortunately I had a leak in my heating system (water - :rage: :rage: :rage:), so my office space was converted to living room

But there is hope today the concrete layer was finished. This means I get my office back and hopefully a few minutes to correct what you describe above. I really aprreciate the detalied description.

Since a lot has changed in the marketplace binding of ZoneMinder, you might hav luck changing to that (I haven’t checked if it is so).

I have added the fix to my rework branch. I will try to get it into a decent state, so I can release something to the marketplace.

Thx for your contribution!

Dang, glad you got your place back in shape.

The reason I rather dabble in the source is that I want to add the image stream to each monitor handler - reason being:
(1) zoneminder gives a uniform API to all installed cam’s, all cam config is done in one place
(2) zoneminder (at least when you do motion detection) needs to run on a bit beefier box anyways, so scaling/transforming/overlaying images is done on the ZM computer and won’t affect OHAB2 performance.

This is what I got so far:

This is a updated jpeg image each time the monitors update, so still gonna need to do actual streams, some cleanup and finalize the config options.

Would you be up for accepting this into the mainstream zoneminder binding? If you’re ok with it, I’ll send you a pull request once I got it to a point where it’s a bit more polished.

Cheers,
-Th

1 Like

I would be glad to accept any contribution. I suggest that I do a checkin of miy changes to the zoneminder4j API, Then create two branches, one for bugfixes and one for development. Then you should be able to contribute in a somewhat meaning full way.

Status of the API is that the session handling has changed quite a bit. Also error handling has changed, though I would still like a better approach.

Yep, sounds like a plan!

The good news (for me at least) is that the stream/image additions I’m creating for the OHAB ZM binding don’t even require much of the zoneminder4j lib (the reason I traced the NPE down was just that I was annoyed not seeing updates on the zm monitor channels).
The image/stream stuff doesn’t use the session-based ZM REST API (there is nothing there for streams), but uses the nph-zms streaming server of ZM that only requires the credentials as part of the request. All I really needed for that is the credentials and the monitor ID from the config, and an additional (raw/image) channel in the MonitorHandler.

Cheers,
-Th

1 Like

@mr_eskildsen: it’s probably better to use github to communicate bug/issues/features than this forum, so I just started here:

If you’re ok with that, I’d rather use GH for bugs going forward, and keep design/architectural stuff here on the forum for a broader audience.

Cheers,
-Th

GH would be a better solution, rather than describing issues in a thread :slight_smile:

1 Like

Got the new ZM installed today. So very sexy. Added all my cameras as motion sensors for my lighting. Works much more reliably than my battery powered motion sensors.