ZoneMinder Binding cannot connect to the API

Strange. As far as I can see it doesn’t connect to ZoneMinder. The obvious problems is wrong user and/or password, and no connection to server. None those issues seems to be the answer.

What version of ZoneMinder are you using?
What is your language settings in ZM?

hi @mr_eskildsen

I use ZM version 1.31.1
Language is en_gb

OK, In my setup I am running 1.30.4 have you checked the previous post:

So the question is: Have you swapped to the new configuration file to get the API functioning again?

hi
I’m on Debian, my conf file are in /etc/apache/conf-enabled/ and I do not have zoneminder.conf.rpmnew
Do you have this file, can you send me?

Marco

I am also running 1.30.4, which is the version I upgraded to that had the Apache config update.

Since I am running an older version of ZM my config file won’t help. How have you insatleld 1.31 ? I don’t see any package (at least for ubuntu)

Hi @5iver
can you share your Apache configuration file?

Thanks

#
# 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]

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>

Hi,
I loaded this conf file on my apache, ZM seem works, but no video on monitor are shown, API works (I can use ZM ninja) but Binding not.

Marco

I think you need to be more precise. You writes that ZM works, but no video on monitors are shown. Do you expect that video is available through the binding?
By the way how have you configured the binding? I suggest that you start with configuration of bridge through PaperUI.
what happens if you enter (in a browser):
http://192.168.1.76/zm/api/monitors.json
Do you get json back?

Since you are running a newer (development 1.30.1) version of Zoneminder than I am (1.30.4), using my Apache config may cause more problems. In fact, unless there are features in 1.31.1 that you need/want, you may want to downgrade to the latest stable release to see if that resolves your issue.

Hi,

I run version 1.31.1. I loaded your version of zoneminder.conf. Apache start without error, Zoneminder works, but no video on Zoneminder web pages but API work, I can retrieve monitor list with curl command.

Binding never work neither with mine or yours zoneminder.conf.

Strange things is that API called outside bindings it works fine. I cane use mobile app ZMNinja that is fully based on API, and i just have a simple integration il place between OH2 and ZM using curl and exec binding.

Marco

Have you tried to access API from the server where you run openHAB?

I would also check your Apache and Zoneminder logs to see if they reveal any information.

1 Like

Hi @mr_eskildsen,
I just have an self made integration using API and Exec Binding, co calling ZM API from Openhab server is working.

@5iver
Let me know which log from Apache you need.

Marco

Look in /var/log. Mine are in /var/log/httpd. error_log is probably the best bet, but access_log may have something.

Ok, just wanted to be sure That it wasn’t a firewall.

Really strange. I wiil write a small java application, that you can run from commandline on your openhab server. You will have to type in url, username, password etc. It will then use the same interface to ZoneMinder as the binding. That should show whats up here.

You are 150% sure that username and password is correct in your binding config?
Have you tried to disable username and password in ZoneMinder?

hi @mr_eskildsen
i use this username and password to login from web page on ZM, so yes, it is correct.
Let me have java app, and I’ll try on my system.

Thanks a lot

Marco

I have now identiified the problem @marcolino7 has described. It seems to be due to a combination of changes in 1.31 and a bad algortihm for identifying if a user is logged on or not. So for the time being I won’t recommend using ZoneMinder 1.31, because it is incompatible with the binding.

The good news is that I have started rework, and this problem was already in the rework scope (improvements for the login process)

1 Like