Cannot connect to Zoneminder

This is my first post, hopefully I can get everything formatted correctly.

I am having trouble getting Zoneminder to work with Home Assistant. Zoneminder is running fine on a Debian server. I can also log in on my local network windows 10 PC using serverIPaddress /zm; however, when add the Zoneminder component to the configuration. yaml I get a configuration error. Below is my system information, configuration. yaml info, home assistant log and hassio homeassistant log. The errors indicate a connection error, but I do not know how to determine what is causing it. Any suggestions on how to trace down what is blocking the connection is appreciated, I ran out of ideas?

System

  • Home assistant Raspberry Pi running Hassio version 0 .83.1 new 0.83.1
  • Zoneminder separate server running on Debian Stretch. Firewall is not enabled
  • Zoneminder version 1.30.4
  • Asus RT-N66U (note I did disable the router firewall just to test with no change.)

My configuration.yaml is simple:
zoneminder:
host: 192.168.1.xxx
camera:
- platform: zoneminder

I did validate that the defaults path is /zm/ and the path_zms is /zm/cgi-bin/nph-zms are the correct paths in zoneminder.
I do not have a password setup up in zoneminder at this time however I did set one up and tried using a password with the same result.

Below is are errors from the home assistant log. I do have debug enabled.

2018-11-29 19:47:53 INFO (MainThread) [homeassistant.loader] Loaded zoneminder from homeassistant.components.zoneminder

2018-11-29 19:47:53 INFO (MainThread) [homeassistant.setup] Setting up zoneminder

018-11-29 19:47:57 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=zoneminder, service=set_run_state>

2018-11-29 19:47:57 ERROR (SyncWorker_1) [zoneminder.zm] Connection error logging into ZoneMinder

2018-11-29 19:47:57 INFO (MainThread) [homeassistant.setup] Setup of domain zoneminder took 4.2 seconds

- [zoneminder](https://home-assistant.io/components/zoneminder/)

Please check your config., notification_id=invalid_config, service_call_id=ba75ef9586d542dbaf01893afe2546fd>

2018-11-29 19:47:57 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=persistent_notification.invalid_config, old_state=None, new_state=<state persistent_notification.invalid_config=notifying; title=Invalid config, message=The following components and platforms could not be set up:

- [zoneminder](https://home-assistant.io/components/zoneminder/)

2018-11-29 19:47:57 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of camera.zoneminder. Setup failed for dependencies: zoneminder

I also SSH’d into hass.io, below are the erros found in the hassio homeassistant log

2018-11-29 18:54:09 ERROR (MainThread) [homeassistant.core] Error doing job: Fatal error on transport TCPTransport (error status in uv_stream_t.read callback)

OSError: [Errno 113] Host is unreachable

Any luck, i’m having trouble as well.

Still working on it but after a lot of work I found the issue is really with zoneminder. Apparently the installation was not correct and the zoneminder API was not fully installed, in my case the Plugin folder was missing /usr/share/zoneminder/www/api/app/Plugin/.

You can validate that the API is working with these steps from https://github.com/pliablepixels/zmNinja/wiki/Validating-if-APIs-work-on-ZM

Make sure ZM APIs are working:

  • Step 1: Open up a browser
  • Step 2: Log into ZM
  • Step 3: Open another tab in the same browser ( IMPORTANT : Has to be from the same browser you logged into ZM)
  • Step 4: Type in http://server/zm/api/host/getVersion.json

you should see a response like:

{ “version”: “1.30.0”, “apiversion”: “1.0” }

In my case I did a clean install of zoneminder using these instructions
https://wiki.zoneminder.com/Debian_9_64-bit_with_Zoneminder_1.30.4_the_Easy_Way

The API is now working and Home Assistant connects without errors but somehow I messed up zoneminder and cannot get streaming to work. I will be probably have to get help on zoneminder forum to fix my current issue.

Hi,

I’m in the exact same situation as you @pete99. I have added a switch and can even go between modetect and monitor modes but not actually get the stream.

My setup is a bit different than yours. I’m running Hass.io on a Rpi3 and Zoneminder in OMV using this docker container (https://hub.docker.com/r/dlandon/zoneminder). Zoneminder works fine but I get this error in my home assistant logs:

 Cannot connect to host 192.168.86.129:8443 ssl:None [[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)]

This is my ZM config; and I have ssl verify set to false so not sure why it should be trying to verify it. The SSL cert is generated by the docker container; no http access.

zoneminder:
  host: 192.168.86.129:8443
  path: /zm/
  username: !secret zoneminder_user
  password: !secret zoneminder_pass
  ssl: true 
  verify_ssl: false

I seem to have he same issue.

Everyone struggling with this check this link out

Just to summarize the solution:

The problem was not with the Zoneminder addon itself but with the Zoneminder installation. The maintainer of this specific Zoneminder container removed http (port 80) access due to security concerns; and enabled SSL with a self-signed certificate.

Due to the self generated SSL cert being assigned to localhost (assuming home assistant is on another machine) caused SSL errors during zoneminder configuration for the streaming of webcam. Sensors seemed to work fine.

Solution: generate a SSL cert using letsencrypt for your domain (duckdns, local ip, etc) and copy it to the Zoneminder config folder in keys. The fullchain.pem file is renamed to cert.crt and privkey.pem to cert.key. Edit the ServerName file and enter the FQDN (Fully Qualified Domain Name) that is attached to your cert. For most this will be the domain (xxxx.duckdns.org or local hostname of zoneminder server).

Restart Zoneminder docker container. Modify home-assistant configuration for zoneminder host entry to the same as FQDN. SSL enabled; verify false. Restart HA.

Recommended: since you now may have opened up the zoneminder server to the internet; I would recommend adding a user and password to zoneminder and enabling auth access. Create a user specific for home assistant with the appropriate permissions and add that to your confuration.yaml file and reboot.

Assuming all is configured correctly streaming should work; and in theory be more secure.