Trigger zoneminder events

Anyone have some examples for setting up rules and triggers between openhab and zoneminder?

I just got the zoneminder binding to run. I’m about to start setting up the individual monitors.

One example of what I want to do is have a rule so when the garage door opens or closes a command is send to zoneminder to set a specific monitor to alert start for a certain time period, say 60 seconds.

Actually running into a much more basic problem first. I added the binding, got it working and then added one monitor. Tried to create an image card widget to point to an image (snapshot) from that camera and I can’t figure out how to get it done. Tried multiple methods adding and linking and just can’t figure it out. I think I’ve got the thing added correctly but at this point I’m not sure of much of anything with this binding.

What would the typical workflow be to add an image-card to a page that would show a recently obtained image from a zoneminder monitor?

Try linking an item to the Video URL channel and see if you can get a feed to an image card. At least that will verify correct setup.

I believe you also need to set an Image Refresh Interval on the Monitor Thing for it to refresh images.

Things are there and online, for instance


I’ve got links to the channels for “Image URL”, “Video URL” and “Image”.

I think that’s where I’m not getting it right. I don’t see any items to choose when setting up an image card to test.

Just ran a few console commands.

openhab> things list |grep front
zoneminder:monitor:icezone_zm:306 (Type=Thing, Status=ONLINE, Label=Zoneminder Monitor front-ptz, Bridge=zoneminder:server:icezone_zm)
zoneminder:monitor:icezone_zm:103 (Type=Thing, Status=ONLINE, Label=Zoneminder Monitor Garage, Bridge=zoneminder:server:icezone_zm)

openhab> items list | grep zone
Zoneminder_Monitor_Garage_Video_URL (Type=StringItem, State=https://hostname:443/zm/cgi-bin/zms?mode=jpeg&monitor=103&token=<long token>, Label=Video URL, Category=, Tags=[Point], Groups=[Zoneminder_Monitor_Garage])
zoneminder (Type=LocationItem, State=NULL, Label=Zoneminder, Category=, Tags=[Location])
Zoneminder_Monitor_Garage_Image_URL (Type=StringItem, State=https://hostname:443/zm/cgi-bin/zms?mode=single&monitor=103&token=<long token>, Label=Image URL, Category=, Tags=[Point], Groups=[Zoneminder_Monitor_Garage])

openhab> links list | grep front
Zoneminder_Monitor_frontptz_Image -> zoneminder:monitor:icezone_zm:306:image Configuration[]
Zoneminder_Monitor_frontptz_Image_URL -> zoneminder:monitor:icezone_zm:306:imageUrl Configuration[]
Zoneminder_Monitor_frontptz_Video_URL -> zoneminder:monitor:icezone_zm:306:videoUrl Configuration[]

I may be getting confused about things vs items vs links. I’ve never really wrapped my head around how all that is supposed to work. So I’m probably missing a step somewhere along the way that would be obvious if I had a better understanding on how all this gets tied together.

Here are my Things and Items (from Code tab). See if your setup is similar:

Server Thing:

UID: zoneminder:server:9bc554a6de
label: ZoneMinder Server
thingTypeUID: zoneminder:server
  defaultAlarmDuration: 60
  discoveryEnabled: true
  refreshInterval: 5
  urlPath: /zm
  useSSL: false

Monitor Thing:

UID: zoneminder:monitor:977a40ac29:16
label: Zoneminder Monitor Garage Cam
thingTypeUID: zoneminder:monitor
  alarmDuration: 60
  monitorId: "16"
bridgeUID: zoneminder:server:9bc554a6de

Make sure the Monitor thing has the Parent Bridge set to Server Thing (an obvious one, but just checking)

Item Linked to Garage Cam (Video URL Channel)

label: Garage Cam Video URL
type: String
category: camera
  - Garage
groupType: None
function: null
  - Point
  - Camera

The Item URL should look something like:


If everything is online and connected properly, your setup should look like this, of course with different IPs and naming convention.

Got the bridge and monitor things defined and they look pretty much identical to those.

I think the ways I’ve tried to add items as links is where I’m missing a step or doing it wrong.

I go to the list of Things, find the monitor, click on the Channels tab and the Unlinked tab there. Click “Add points to model” or “Add equipment to model” and select the Image URL and Video URL items.

After that if I look at the item it appears to have failed to populate with the correct info;

label: Video URL
type: String
category: ""
groupNames: []
groupType: None
function: null
  - Point

I see. Try it this way

In the same screen where you are (Unlinked tab), find the appropriate channel and click it. You will see “Add Link to Item…”

Create a new item from that screen and you should have a nicely linked item to the channel. Using the model is not necessary, at least not now. If you are still getting…

a better understanding on how all this gets tied together

…I would use the process I described. You can always go back and update the Items you create with Group Membership and Semantic Class info.

I’m also trying to get the binding to work, there’s documentation online but the examples given have no links back to the creation of the items so trying to figure out what to set up isn’t going well. So far I’ve tried using the examples provided in the binding documentation but as it calls triggers against items but doesn’t show you how to create those items. I’m just gettnig a lot of errors at the moment.

I might go back to trying to find a replacement for the TCP/UDP binding which is what I was using before, unless I can find out how to actually work the Zoneminder binding. So if anyone has a clear process for how to get an alarm to trigger, I’d be interested to see it.

Aha, I think I’ve figured it out.

Create your zoneminder bridge then use autodiscover to get the things for the individual monitors. You don’t need to bind any channels, but each monitor thing has an identifier, which you will need.

Then in your rule, at the top put this for each monitor (note the monitor ID at the end, 5 and 8 in these examples:

val zmGarage = getActions("zoneminder", "zoneminder:monitor:8536d76536:5")
val zmShed = getActions("zoneminder", "zoneminder:monitor:8536d76536:8")

In the rules themselves, put the following to trigger an alarm:


The above will cause a 5 minute event to be recorded on a Zoneminder monitor set to “Nodect” mode. That’s enough for me.