Problem with new Zoneminder component

I have added the new Zoneminder component as follows:

zoneminder:
  host: vali

There are no errors in the log, so it looks like this part is OK. In my sensors.yaml I have added:

- platform: zoneminder

and in switch.yaml:

- platform: zoneminder
  command_on: Modect
  command_off: Monitor

But the sensor and switch are not showing up in my “Current entities” tab.

Any idea what could be wrong? Am using a fresh ZM installation.

1 Like

I wrote the plugin :slight_smile:

The only time I had that happen was when I was testing if a host was configured incorrectly, but it always threw an error about it as well. Either a big traceback if it couldn’t lookup the host or something like:
ERROR:homeassistant.components.zoneminder:Connection error logging into ZoneMinder

If it had that path set incorrectly.

When you use the zoneminder web interface, do you connect to it like http://vali/zm/ ? (or are you using https?)
What version of zoneminder are running? (I only tested with the current release version of 1.30.0)

You could always login to your zoneminder host and verify in the apache logs that home-assistant is actually connecting to it as well.

If you want to post the startup logs from ha (or pm them to me) I can help you take a look for anything odd. Your config looks like it should work fine tho.

Hi there!

First of all, thank you for making this component, I coincidentally started with Zoneminder a few days ago, after which I noticed support was just added to my HA system, hah :slight_smile:

I only had ZM errors in the HA log when I hadn’t upgraded HA yet, after that process, no more errors.

The apache logs on the ZM host look fine to me (.15 is the HA host):

access_log:192.168.10.15 - - [28/Oct/2016:08:48:30 +0200] "GET /zm/api/monitors/1.json HTTP/1.1" 200 2372 "-" "python-requests/2.11.1"
access_log:192.168.10.15 - - [28/Oct/2016:08:49:00 +0200] "GET /zm/api/monitors/1.json HTTP/1.1" 200 2372 "-" "python-requests/2.11.1"
access_log:192.168.10.15 - - [28/Oct/2016:08:49:00 +0200] "GET /zm/api/monitors/1.json HTTP/1.1" 200 2372 "-" "python-requests/2.11.1"
access_log:192.168.10.15 - - [28/Oct/2016:08:49:00 +0200] "GET /zm/api/events/index/MonitorId:1.json HTTP/1.1" 200 39309 "-" "python-requests/2.11.1"
access_log:192.168.10.15 - - [28/Oct/2016:08:49:30 +0200] "GET /zm/api/monitors/1.json HTTP/1.1" 200 2372 "-" "python-requests/2.11.1"
access_log:192.168.10.15 - - [28/Oct/2016:08:49:30 +0200] "GET /zm/api/events/index/MonitorId:1.json HTTP/1.1" 200 39309 "-" "python-requests/2.11.1"
access_log:192.168.10.15 - - [28/Oct/2016:08:49:30 +0200] "GET /zm/api/monitors/1.json HTTP/1.1" 200 2372 "-" "python-requests/2.11.1"

There’s actually no mention of ZM in the HA logs, but I have log level set to “warning”, would setting it to “debug” and restarting be helpful in this case?

Sorry, thats really odd. Those logs make it look like they’re working correctly at the very least. It almost seems like zoneminder isn’t returning the same json as my install does or something. Can you try curling those endpoints “curl http://vali/zm/api/monitors/1.json

You should get a response something like this:

{
“monitor”: {
“Monitor”: {
“Id”: “2”,
“Name”: “Living Room”,
“ServerId”: “0”,
“Type”: “Ffmpeg”,
“Function”: “None”,
“Enabled”: “1”,
“LinkedMonitors”: “”,
“Triggers”: “”,
“Device”: “/dev/video0”,
“Channel”: “0”,
“Format”: “255”,
“V4LMultiBuffer”: false,
“V4LCapturesPerFrame”: “1”,
“Protocol”: “http”,
“Method”: “rtpRtsp”,
“Host”: ",
“Port”: “80”,
“SubPath”: “”,
“Path”: “”,
“Options”: “-r 30 -b:v 6000k”,
“User”: “”,
“Pass”: “”,
“Width”: “1280”,
“Height”: “720”,
“Colours”: “3”,
“Palette”: “0”,
“Orientation”: “0”,
“Deinterlacing”: “0”,
“RTSPDescribe”: false,
“Brightness”: “-1”,
“Contrast”: “-1”,
“Hue”: “-1”,
“Colour”: “-1”,
“EventPrefix”: “Event-”,
“LabelFormat”: “%N - %d/%m/%y %H:%M:%S”,
“LabelX”: “0”,
“LabelY”: “0”,
“LabelSize”: “1”,
“ImageBufferCount”: “50”,
“WarmupCount”: “25”,
“PreEventCount”: “25”,
“PostEventCount”: “25”,
“StreamReplayBuffer”: “1000”,
“AlarmFrameCount”: “1”,
“SectionLength”: “600”,
“FrameSkip”: “0”,
“MotionFrameSkip”: “0”,
“AnalysisFPS”: “0.00”,
“AnalysisUpdateDelay”: “0”,
“MaxFPS”: “0.00”,
“AlarmMaxFPS”: “0.00”,
“FPSReportInterval”: “1000”,
“RefBlendPerc”: “6”,
“AlarmRefBlendPerc”: “6”,
“Controllable”: “0”,
“ControlId”: “0”,
“ControlDevice”: null,
“ControlAddress”: null,
“AutoStopTimeout”: null,
“TrackMotion”: “0”,
“TrackDelay”: “0”,
“ReturnLocation”: “-1”,
“ReturnDelay”: “0”,
“DefaultView”: “Events”,
“DefaultRate”: “100”,
“DefaultScale”: “100”,
“SignalCheckColour”: “#0000c0”,
“WebColour”: “red”,
“Exif”: false,
“Sequence”: “1”
}
}
}

If that’s not the case, then send me the output and I can try and mock it up on my local install and see whats up with it.

Yea the output looks fine to me:

http://pastie.org/pastes/10952665/text?key=7qbvcceb6p0czhczbbfclg

@khabi

I just installed 0.34.4 and have zoneminder configured as such in configuration.yaml:

zoneminder:
  host: garage
  path: /zm/
  ssl: False
  username: admin
  password: secret

sensor 6:
  platform: zoneminder

Zoneminder is running, and I can see my cameras right now through the control panel. I followed the directions here to authenticate using curl and get the cookie file, and am able to get the JSON back from monitor 1 as you recommended above:

{
    "monitor": {
        "Monitor": {
            "Id": "1",
            "Name": "Back",
            "ServerId": "0",
            "Type": "Ffmpeg",
            "Function": "Monitor",
            "Enabled": "1",
            "LinkedMonitors": "",
            "Triggers": "",
            "Device": "\/dev\/video0",
            "Channel": "0",
            "Format": "255",
            "V4LMultiBuffer": false,
            "V4LCapturesPerFrame": "1",
            "Protocol": "",
            "Method": "rtpRtsp",
            "Host": "",
            "Port": "80",
            "SubPath": "",
            "Path": "rtsp:\/\/admin:[email protected]\/Streaming\/channels\/1",
            "Options": "",
            "User": "",
            "Pass": "",
            "Width": "2688",
            "Height": "1520",
            "Colours": "3",
            "Palette": "0",
            "Orientation": "0",
            "Deinterlacing": "0",
            "RTSPDescribe": false,
            "Brightness": "-1",
            "Contrast": "-1",
            "Hue": "-1",
            "Colour": "-1",
            "EventPrefix": "Event-",
            "LabelFormat": "%m\/%d\/%Y %H:%M:%S",
            "LabelX": "0",
            "LabelY": "0",
            "LabelSize": "1",
            "ImageBufferCount": "50",
            "WarmupCount": "25",
            "PreEventCount": "25",
            "PostEventCount": "25",
            "StreamReplayBuffer": "1000",
            "AlarmFrameCount": "1",
            "SectionLength": "600",
            "FrameSkip": "0",
            "MotionFrameSkip": "0",
            "AnalysisFPS": "0.00",
            "AnalysisUpdateDelay": "0",
            "MaxFPS": "0.00",
            "AlarmMaxFPS": "0.00",
            "FPSReportInterval": "1000",
            "RefBlendPerc": "0",
            "AlarmRefBlendPerc": "0",
            "Controllable": "0",
            "ControlId": "0",
            "ControlDevice": null,
            "ControlAddress": null,
            "AutoStopTimeout": null,
            "TrackMotion": "0",
            "TrackDelay": "0",
            "ReturnLocation": "-1",
            "ReturnDelay": "0",
            "DefaultView": "Events",
            "DefaultRate": "100",
            "DefaultScale": "100",
            "SignalCheckColour": "#0000c0",
            "WebColour": "red",
            "Exif": false,
            "Sequence": "1"
        }
    }
}

The hass log shows this:

16-12-12 21:37:23 INFO (MainThread) [homeassistant.loader] Loaded zoneminder from homeassistant.components.zoneminder
...
16-12-12 21:37:24 INFO (MainThread) [homeassistant.loader] Loaded sensor.zoneminder from homeassistant.components.sensor.zoneminder
16-12-12 21:37:24 INFO (MainThread) [homeassistant.bootstrap] Setting up zoneminder
16-12-12 21:37:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=zoneminder>
16-12-12 21:37:25 INFO (MainThread) [homeassistant.bootstrap] Setting up sensor
16-12-12 21:37:25 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.zoneminder

However, on the “States” page, I see no device related to zoneminder.
Any ideas? :slight_smile:

Is there a way to change the state only of one of the cameras and not all of them?

I am having the same exact issue; were you ever able to get zoneminder working?

I have not tried since – will attack this problem soon though, in the next week or two.

I think I was misunderstanding what I thought I would see when adding zoneminder to home assistant. I was under the assumption that I would be able to see my live camera feeds in home assistant, but I don’t think that is the case. Once you add zoneminder, it appears you can only see the number of events for each camera as well as change the setting for each camera via home assistant (like enable motion detection for a particular camera). So most likely I had it working all along, but was just disappointed it wasn’t showing my live camera feeds.

I can no longer log into Zoneminder from HomeAssistent.

Error in log from HomeAssistant:

17-04-03 13:57:53 INFO (MainThread) [homeassistant.loader] Loaded zoneminder from homeassistant.components.zoneminder
17-04-03 13:57:53 INFO (MainThread) [homeassistant.setup] Setting up zoneminder
17-04-03 13:57:54 ERROR (Thread-9) [homeassistant.components.zoneminder] Connection error logging into ZoneMinder
17-04-03 13:57:54 ERROR (MainThread) [homeassistant.setup] Setup failed for zoneminder: Component failed to initialize.

But in log from Zoneminder:

2017-04-03 13:57:53.660057 web_php 4111 INF Login successful for user “hass” /usr/share/zoneminder/www/includes/functions.php 53

Homeassistant version 0.41.0
Zoneminder version: 1.30.2

Did you get this working? I use this to see my feeds from zoneminder:

You have to use both.

Yes, only recently, the above was released and I now can see my live camera feeds in HA. Only problem I’m seeing with ZM and HA is a timing issue when I reboot my machine. HA is starting up before ZM can and it’s not able to see ZM until I restart HA. Been meaning to post to the forums; maybe the ZM component can be updated to wait or keep looking when ZM comes up?

I did some research on the internet.
It looks like version 1.30.2 of Zoneminder has issues with the API.
I cannot get it working with other app either.
Zoneminder works nice via the webinterface. But third party app can login but not see the video streams.
I guess HomeAssistant plugin for Zoneminder has the same problems.

I was never able to get that version of ZM working. I tried on three different machines and multiple versions of Ubuntu. I always reverted to using 1.29.0.

I will try this evening to roll-back. Probably not easy because of database changes. So I have to start from scrach, loosing all setup etc.

I had the same API issues with 1.30.2. This post below has a workaround to re-create missing tmp folders that get blown away upon reboots; this worked for me to fix the API,

1.30.2 upgrade breaks API access

This does not fix the startup timing issue I was having with ZM and HA…

HA version 0.45.1
Ubuntu server 16.04
Apache 2.4.18
PHP 7.0.18
Zoneminder 1.31.0 h264 video storage

I’m facing authentication error:

127.0.0.1 - - [02/Jun/2017:07:31:36 +0300] "POST /zm/index.php HTTP/1.1" 302 624 "-" "python-requests/2.14.2" 127.0.0.1/zm/index.php
127.0.0.1 - - [02/Jun/2017:07:31:36 +0300] "GET /zm/index.php?view=console HTTP/1.1" 200 3904 "-" "python-requests/2.14.2" 127.0.0.1/zm/index.php?view=console
127.0.0.1 - - [02/Jun/2017:07:31:37 +0300] "GET /zm/api/host/getVersion.json HTTP/1.1" 401 422 "-" "python-requests/2.14.2" 127.0.0.1/zm/api/host/getVersion.json

root@unholy13sfc:~# tail -f /var/log/apache2/error.log
[Fri Jun 02 07:31:36.281084 2017] [:error] [pid 27540] [client 127.0.0.1:50510] INF [Login successful for user "homeassistant"]

curl requests, browser and even zmNinja PC application works,
so I think issue is with component itself?

Same problem with HA 0.50.1.
zmNinja and other works, but HA no…

I just updated to HA 0.50.1
Still works.

Previous I had problems. That had to do with the ZM package from Ubuntu. Did not create all paths/folders.