I have same version on my Windows machine, where i tested the “patch”. Given that version it should work, so there might be something else wrong. Obvoiusly it is with the binding.
I haven’t had success in changing properties in OpenHAB, it simply just fails and stays on the old properties. Have you checked that your properties was changed or not?
Either you can delete the bridge (ZoneMinder Server) or else you can just add a extra bridge to check if that comes online.
If you delete the bridge it seems to work that you just gives your new bridge the same id (then things is just mapped to the new bridge)
Yes, the properties do misbehave - I get 500 internal errors, and the settings don’t change - so I resorted to deleting the bridge and adding a new one.
However even then, with the correct http / port 80 properties it doesn’t work, giving me this in the logs:
I am not sure if this behaviour is a OH problem or a ZoneMinder binding problem.
Can you connect to your ZoneMinder Server via a browser on port 80?
Can you connect with telnet to port 6802?
Have you enabled API in ZoneMinder? Check the readme page, I have written a few things that should be done.
Could there be some firewall or something else blocking port 80 on your zm server?
Else I think next step is a debug log…
Update: It just struck my mind: Have you changed the path for the landing page in ZoneMinder. That might also give a error 500?
Default is http://<serverIP>/zm
I guess you mean either OPT_USE_API or OPT_TRIGGERS? OPT_CONTROL should not be neccessary to enable.
I will enhance the ReadMe to make this clear. When those is not enabled it gives strange errors. I will also look in the code to see if error handling might be improved here.
I am trying to get the Zoneminder binding to work. How do you determine the port# of zoneminder to enter into the settings . When I try port 80 from my computers browser I get this message: “Apache2 Ubuntu Default Page”. So I don’t think its that. To load zondeminder I use the IP address followed by /zm. Any help would be appreciated.
Thanks Dan, I got it working. Could you share your OpenHab setup with zoneminder, such items, sitemap and any rules. This is what I currently have:
Items:
String BackYardIPCam "Back Yard IP Camera" {channel="zoneminder:monitor:xxxxx:monitor-2:function"}
String FrontYardIPCam "Front Yard IP Camera" {channel="zoneminder:monitor:xxxxx:monitor-1:function"}
Switch ZoneMinder "Zoneminder Status" {channel="zoneminder:server:xxxxx:is-alive"}
Number CPULoad "CPU Usage [%d]" {channel="zoneminder:server:xxxxx:cpu-load"}
Number DiskUsage "Disk Usage [%d]" {channel="zoneminder:server:xxxxx:disk-usage"}
The switches all report the correct the information from Zoneminder, but I am unable to change the settings of the cameras in OpenHAB. Such as changing a camera from Monitor to Modect. Also the CPULoad and DiskUsage amounts are not showing up on the sitemap.
I too couldn’t get CPULoad or DiskUsage to work, and haven’t tried changing camera modes. I use it only to detect movement on some cameras, and activate recording on others.
My setup is as follows:
I have one camera in Modect mode watching for movement by the front/street door. Zoneminder will record all that movement. I use the binding to detect loitering, i.e. movement continuing for more than two minutes. It then alerts me.
I have another camera in Nodect mode which I trigger to start recording on certain events (e.g. an alert on the street door).
Hence my rules read zmStreetTrig (movement) and write zmLivingRoomTrig (to start recording).
An example of the loitering detection rule:
Rule "Street alarm processing"
when
Item zmStreetTrig changed to ON
then
var Number Cleared
var Number i
logInfo("CAMS", "Street cam alarm received. Will now see if active for 2 minutes")
Cleared=0
i = 1
while ((i=i+1) < 8) {
Thread::sleep(15000)
if (zmStreetTrig.state==ON) {
logInfo("CAMS", "Street cam alarm still active")
} else {
logInfo("CAMS", "Street cam alarm not active")
Cleared=1
}
}
if (Cleared==0) {
logInfo("CAMS", "Street cam alarm was active for all 90 seconds - triggering response")
// notifications etc go here
} else {
logInfo("CAMS", "Street cam alarm not active for all 90 seconds - disregarding")
}
end
I have another simple rule to notify me if zmAlive goes off, because presumably my zoneminder system is down for some reason.
The sitemap then just has two switches, one showing me if there is movement on the street, another letting me manually start recording on the living room camera:
By default diskusage count is disabled. It is because the zonemidner server uses a du xommand, more or less from the root of the drive. I read some posts, about it, and thought that polling this every 10 seconds won’t do your ZoneMinder server any good. And DiskUsage shouldn’t change from no problem to a problem in 10 seconds time… I was a bit undetermined of what would be a good interval., so I have set it to zero eg. disabled). Cpu load shouldn’t be affected by it, but there might be a bug there. I guess that might be a possibility (haven’t tested that aspect…).
Until now I have only tested the write back mechanishm (eg. to change from modect to monitor and vice versa. In the debbugger it seemed to work just fine, but in my newly installed OH2 (three days ago) it doesn’t work (actually nothing happends). This is obviously a bug, I need to dig a little bit into that one.
sitemap zoneminder label="Zoneminder"
{
Frame {
Text item=zmsIsAlive label="ZoneMinder Server [%s]" {
Frame {
Switch item=zmsIsAlive
Text item=zmsCpuLoad
Text item=zmsDiskUsage
Text item=zmsServerVersion
Text item=zmsServerApiVersion
}
}
Text item=zmMonitor1_Function label="Monitor-1 [%s]" {
Frame {
Text item=zmMonitor1_Name
Switch item=zmMonitor1_Enabled
Text item=zmMonitor1_SourceType
Switch item=zmMonitor1_TriggerEvent
Text item=zmMonitor1_Function
Text item=zmMonitor1_IsAlive
Text item=zmMonitor1_CaptureStatus
Text item=zmMonitor1_CaptureStatusText
Text item=zmMonitor1_AnalysisStatus
Text item=zmMonitor1_AnalysisStatusText
Text item=zmMonitor1_FrameStatus
Text item=zmMonitor1_FrameStatusText
}
}
}
}
I am sorry that I haven’t answered, but I have been busy on cleaning my own OH install (I have had some problems in my production environment that I needed to take care of urgently). So all my plans of looking into Zoneminder Binding has been postponed.
I will try to prioritize the issue with setting values from OpenHAB (eg. function mode and Trigger)
EDIT (2016.12.29): Typo in items section fixed. (Swicth → Switch)
I have been looking at the code, and certainly all of the parameters that could be set from OpenHAB was set properly. The Trigger failed, and “Enabled” and “Function” needs some additional coding…
I have now impelemented the two missing functions, so now you should be able to toggle the Enabled State from OpenHAB and also change the Function between the six allowed states: None, Monitor, Modect, Mocord, Record, Nodect.
Hmmm, well spoitted. I actually copied my rules from OH1 and when I copied to the readMe I noticed the import s and remembered that I have read somewhere that at least some of them wasn’t neccessary. I then thought: Nobody will notice…
But I was obviously wrong. I will update the sample config accordingly
Playing around with the binding a bit more, I’ve discovered an odd problem.
Every few minutes the “Is Alive” switch goes off for almost exactly 6.4 seconds (I have the API polling interval set to 5 seconds). I’m fairly sure it’s not a network problem as the ZM server remains accessible throughout (via web or zmNinja)
mr_eskildsen:
Thanks for all your work on the Zoneminder binding. Changing the camera functions from within OpenHAB works great. I still can’t get the disk usage and load feature to work though.
Dan:
I also noticed the “Is Alive” switch changes to off sometimes. I also notice it when I change the function on a camera.
Also, is there a way for OpenHAB to receive a notice from Zoneminder that motion was detected on a camera so that I can set up a rule to react to it?