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

 zoneminder:monitor:icezone_zm:301

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
configuration:
  defaultAlarmDuration: 60
  host: 192.168.0.200
  discoveryEnabled: true
  refreshInterval: 5
  urlPath: /zm
  useSSL: false

Monitor Thing:

UID: zoneminder:monitor:977a40ac29:16
label: Zoneminder Monitor Garage Cam
thingTypeUID: zoneminder:monitor
configuration:
  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
groupNames:
  - Garage
groupType: None
function: null
tags:
  - Point
  - Camera

The Item URL should look something like:

(http://192.168.0.200/zm/cgi-bin/zms?mode=jpeg&monitor=16)

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
tags:
  - 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.