Zoneminder can't get version

I’ve got an up to date zoneminder server running and I’m trying to setup OH3-m3 to access it but can’t get past the initial setup. I keep running into:

Thing 'zoneminder:server:zm' changed from INITIALIZING to OFFLINE (CONFIGURATION_ERROR): Can't get version information

I don’t see anything wrong in my configuration right off the bat.

UID: zoneminder:server:zm
label: ZoneMinder Server
thingTypeUID: zoneminder:server
configuration:
  discoveryEnabled: true
  pass: redacted
  refreshInterval: 5
  host: 10.10.100.100
  defaultAlarmDuration: 60
  user: redacted
  urlPath: /zm
  defaultImageRefreshInterval: 600
  portNumber: 443
  useSSL: true

Is there something I need to do on the zm side to get this working? Or an advanced setting I don’t see?

Btw, I can get to API output via a web browser so I’m pretty sure I got things set up correctly on that side.

https://ipaddress/zm/api/host/getVersion.json returns:

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

Are you using https with a self-signed certificate? If so, it won’t work.

Is the only solution to revert to http or can I use some other cert on the zm side?

I ended up commenting “SSLRequireSSL” from zoneminder.conf on my apache setup. I can still do SSL but non-SSL also. Seems to be working as the zoneminder server is now online in OH.

I’ve added one monitor and I’m trying to get a page setup up now with a snapshot image now but only coming up with a blank picture so far. The image and video URLs don’t work so far. I end up getting

The requested URL /zm/cgi-bin/zms was not found on this server.

http://ipaddress/zm/cgi-bin/zms?mode=single&monitor=101&token=(long token here)

Not sure if I got a config problem of the overall setup or I’m just not accessing things correctly. My thought was to set up a page with thumbnails of images that would then link to video feeds of that image. My cameras have two streams, one low definition and one high definition. In zm I do motion detect on the lowdef and when they fire off the highdef monitor also starts recording.

Could it be something in tha Apache config not mapping the URL containing cgi-bin?

My zoneminder install is from the rpmfusion repo onto a CentOS 7.9 system. I don’t think I changed anything manually after the install except to comment out the SSLRequiredSSL directives. Could be the scriptalias for cgi-bin isn’t matching but I’m not sure where it should change if at all or what to change it to.

Here’s my /etc/httpd/conf.d/zoneminder.conf:

#
# ZoneMinder Apache configuration file
# With SSLRequire and HTTPS auto redirect
# Modify this configuration to suit your requirements
#

# Auto Redirect HTTP requests to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(zm)(.*) https://%{SERVER_NAME}/$1$2 [R,L]

# Order matters. This alias must come first.
Alias /zm/cache "/var/cache/zoneminder"
<Directory "/var/cache/zoneminder">
#    SSLRequireSSL
    Options -Indexes +MultiViews +FollowSymLinks
    AllowOverride None
    <IfModule mod_authz_core.c>
       # Apache 2.4
       Require all granted
    </IfModule>
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order deny,allow
        Allow from all
    </IfModule>
</Directory>

Alias /zm "/usr/share/zoneminder/www"
<Directory "/usr/share/zoneminder/www">
    # explicitly set index.php as the only directoryindex
    DirectoryIndex disabled
    DirectoryIndex index.php
#    SSLRequireSSL
    Options -Indexes +MultiViews +FollowSymLinks
    AllowOverride None
    <IfModule mod_authz_core.c>
       # Apache 2.4
       Require all granted
    </IfModule>
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order deny,allow
        Allow from all
    </IfModule>
</Directory>

ScriptAlias /cgi-bin-zm "/usr/libexec/zoneminder/cgi-bin"
<Directory "/usr/libexec/zoneminder/cgi-bin">
#    SSLRequireSSL
    AllowOverride None
    Options +ExecCGI +FollowSymLinks
    <IfModule mod_authz_core.c>
       # Apache 2.4
       Require all granted
    </IfModule>
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order deny,allow
        Allow from all
    </IfModule>
</Directory>

# For better visibility, the following directives have been migrated from the
# default .htaccess files included with the CakePHP project.
# Parameters not set here are inherited from the parent directive above.
<Directory "/usr/share/zoneminder/www/api">
   RewriteEngine on
   RewriteRule ^$ app/webroot/ [L]
   RewriteRule (.*) app/webroot/$1 [L]
   RewriteBase /zm/api
</Directory>

<Directory "/usr/share/zoneminder/www/api/app">
   RewriteEngine on
   RewriteRule ^$ webroot/ [L]
   RewriteRule (.*) webroot/$1 [L]
   RewriteBase /zm/api
</Directory>

<Directory "/usr/share/zoneminder/www/api/app/webroot">
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    RewriteBase /zm/api
</Directory>

I really have no idea, so this is just a wild guess. But should it be this instead?

ScriptAlias /zm/cgi-bin "/usr/libexec/zoneminder/cgi-bin"

I’ll poke around on it tomorrow and let you know.

If I change to what you think it should be I lose the abiltiy to view live feeds of my monitors. So it’s correct for my setup.

Are there any further details in regards to certificates and setup? I’m running my own CA in my network, ZM has its own certificate issued by my CA, and I get the same error. I presume that I’d need to make OpenHAB aware of the CA Certificate somehow, is this correct?

There are code changes need to make the binding work with self-signed certs. I made those changes a while back because someone asked for it. Then that person disappeared, so there was no one to test the changes. I’ll have to check if I deleted the branch with those changes.

Well, I still have the branch with those changes. But I haven’t looked it in months. And, it probably needs to be rebased on the current master.

@FredNurk What version of openHAB are you running?

3.1. Just updated from 3.02 last night.

Ok, give me a few days. I’ll see if I can build a jar for 3.1.

1 Like

Here’s a link to a jar file for you to test. I’m not able to test this myself, so I don’t know if it will work or not. I modeled it after a couple other bindings that support self-signed certs. :crossed_fingers:

Before dropping this jar file into addons, you need to uninstall the current version of the Zoneminder binding.

Also, there’s a new config parameter in the bridge thing for the cert’s common name. This needs to be set to the common name of your self-signed cert.

https://github.com/mhilbush/openhab-binding-releases/blob/master/zoneminder/org.openhab.binding.zoneminder-3.2.0-SNAPSHOT.jar?raw=true

If you run into any issues, a debug log would be appreciated. Also, please confirm that you’re running this new version by checking the binding’s version number in the console.

Thanks for that. Unfortunately it doesn’t appear to be installing. Leave it with me, whilst I check that I haven’t done something wrong with it.

On earlier 3.1 snapshot releases I was getting an error about a javax.measure dependency issue. I upgraded to the latest snapshot (build 2446) and it installs and runs. This snapshot version must be pretty close to the build number of the 3.1 release.

What do you see in the console when you drop the binding into the addons directory? It should look like this.

openhab> list -s | grep zoneminder
244 │ Active │  80 │ 3.2.0.202106300004    │ org.openhab.binding.zoneminder

If it says Installed versus Active, then there’s a dependency problem. If it’s not there at all, and the jar is in addons, I’m not sure what’s going on. This is what it should look like in the addons directory.

-rwxr--r-- 1 mark mark 57661 Jul  1 12:04 org.openhab.binding.zoneminder-3.2.0-SNAPSHOT.jar

I’m still running 3.1, although I did change to the unstable repo, install 3.2 and tried again without success. The file provided is in the addons folder, only thing I’ve got different is that I’d set the permissions to the openhab user.

Using your console command gives no results. Using feature:list shows the 3.1 version as uninstalled. I did attempt to do the same thing in 3.2 and didn’t really get any results either, although at that point I wasn’t sure whether it was a bundle, feature or both I needed to look at.

I’ll likely attempt to update to 3.2 again and have another go. I appreciate that you’ve put the package together, and note that I may take a little longer to ensure that I’m not just making simple mistakes.

Did you check the file size of the jar? Does it match what I posted above?