Skip to content

ZoneMinder Binding ​

Supports the ZoneMinder video surveillance system.

Supported Things ​

The following Thing types are supported:

ThingIDDiscoveryDescription
ServerserverManualServer bridge manages all communication with ZoneMinder server
MonitormonitorAutomaticMonitor represents a ZoneMinder camera monitor

Installation ​

The binding requires ZoneMinder version 1.34.0 or greater and API version 2.0 or greater. It also requires that you enable the OPT_USE_API parameter in the ZoneMinder configuration.

If your ZoneMinder is installed using a non-standard URL path or port number, you must specify that when you add the ZoneMinder server Thing.

There are two different styles of operation, depending on whether or not you have ZoneMinder configured to use authentication.

Non-Authenticated ​

If ZoneMinder authentication is not used, leave the User and Password parameters empty in the ZoneMinder Server Thing configuration. No other configuration is required.

Authenticated ​

The binding can access ZoneMinder with or without authentication. If ZoneMinder authentication is used, first make sure the ZoneMinder user has the API Enabled permission set in the ZoneMinder Users configuration. Then, enter the username and password into the ZoneMinder Server Thing configuration.

Discovery ​

The server bridge must be added manually. Once the server bridge is configured with a valid ZoneMinder host name or IP address, all monitors associated with the ZoneMinder server will be discovered.

Thing Configuration ​

Server Thing ​

The following configuration parameters are available on the Server Thing:

ParameterParameter IDRequired/OptionalDescription
HosthostRequiredHost name or IP address of the ZoneMinder server.
Use secure connectionuseSSLRequiredUse HTTP or HTTPS for connection to ZoneMinder. Default is HTTP.
Port NumberportNumberOptionalPort number if not on ZoneMinder default port 80.
URL PathurlPathRequiredPath where ZoneMinder is installed. Default is /zm. Enter / if ZoneMinder is installed under the root directory.
Refresh IntervalrefreshIntervalRequiredFrequency in seconds at which monitor status will be updated.
Default Alarm DurationdefaultAlarmDurationRequiredSets the default alarm duration for discovered monitors.
Default Image Refresh IntervaldefaultImageRefreshIntervalOptionalSets the image refresh interval in seconds for discovered monitors. Leave empty to not set an image refresh interval.
Monitor Discovery EnableddiscoveryEnabledRequiredEnable or disable the automatic discovery of monitors. Default is enabled.
User IDuserOptionalUser ID of the ZoneMinder user when using authentication.
PasswordpassOptionalPassword of the ZoneMinder user when using authentication.

Monitor Thing ​

The following configuration parameters are available on the Monitor Thing:

ParameterParameter IDRequired/OptionalDescription
Monitor IDmonitorIdRequiredID of monitor defined in ZoneMinder.
Image Refresh IntervalimageRefreshIntervalOptionalInterval in seconds at which the snapshot image channel will be updated.
Alarm DurationalarmDurationRequiredDuration the alarm will run once triggered by the triggerAlarm channel.

Channels ​

Server Thing ​

ChannelTypeDescription
imageMonitorIdStringMonitor ID to use for selecting an image URL. Sending an OFF command to this channel will reset the monitor ID and URL to UNDEF.
imageUrlStringImage URL for the monitor ID specified by imageMonitorId. Channel is UNDEF if the monitor ID is not set, or if an OFF command is sent to the imageMonitorId channel.
videoMonitorIdStringMonitor ID to use for selecting a video URL. Sending an OFF command to this channel will reset the monitor ID and URL to UNDEF.
videoUrlStringVideo URL for the monitor ID specified by videoMonitorId. Channel is UNDEF if the monitor ID is not set, or if an OFF command is sent to the videoMonitorId channel.
runStateStringSet the run state for the ZoneMinder server.

Monitor Thing ​

ChannelTypeDescription
idStringMonitor ID.
nameStringMonitor name.
imageImageSnapshot image.
enableSwitchEnable or disable monitor.
functionStringMonitor function (e.g., Nodect, Mocord).
alarmSwitchMonitor is alarming.
stateStringMonitor state (e.g., IDLE, ALARM, TAPE).
triggerAlarmSwitchTurn alarm on or off.
hourEventsNumberNumber of events in the last hour.
dayEventsNumberNumber of events in the last day.
weekEventsNumberNumber of events in the last week.
monthEventsNumberNumber of events in the last month.
totalEventsNumberTotal number of events.
imageUrlStringURL for image snapshot.
videoUrlStringURL for JPEG video stream.
eventIdStringID of the most recently completed event.
eventNameStringName of the most recently completed event.
eventCauseStringCause of the most recently completed event.
eventNotesStringNotes of the most recently completed event.
eventStartDateTimeStart date/time of the most recently completed event.
eventEndDateTimeEnd date/time of the most recently completed event.
eventFramesNumberNumber of frames of the most recently completed event.
eventAlarmFramesNumberNumber of alarm frames of the most recently completed event.
eventLengthNumber:TimeLength in seconds of the most recently completed event.

Thing Actions ​

triggerAlarm (with Duration) ​

The triggerAlarm action triggers an alarm that runs for the number of seconds specified by the parameter duration.

triggerAlarm - trigger an alarm ​

dsl
void triggerAlarm(Number duration)
text
Parameters:
duration - The number of seconds for which the alarm should run.

triggerAlarm ​

The triggerAlarm action triggers an alarm that runs for the number of seconds specified in the Monitor Thing configuration.

triggerAlarm - trigger an alarm ​

java
void triggerAlarm()

cancelAlarm ​

The cancelAlarm action cancels a running alarm.

cancelAlarm - cancel an alarm ​

java
void cancelAlarm()

Requirements ​

The binding requires ZoneMinder version 1.34.0 or greater, and API version 2.0 or greater. The API must be enabled in the ZoneMinder configuration using the OPT_USE_API parameter.

Full Example ​

Things ​

dsl
Bridge zoneminder:server:server [ host="192.168.1.100", refreshInterval=5, defaultAlarmDuration=120, discoveryEnabled=true ]

Thing zoneminder:monitor:1 "Monitor 1" (zoneminder:server:server) [ monitorId="1", imageRefreshInterval=10, alarmDuration=180 ]

Thing zoneminder:monitor:2 "Monitor 2" (zoneminder:server:server) [ monitorId="2", imageRefreshInterval=10, alarmDuration=180 ]

Items ​

dsl
// Server
String ZmServer_ImageMonitorId "Image Monitor Id [%s]" { channel="zoneminder:server:server:imageMonitorId" }
String ZmServer_ImageUrl "Image Url [%s]" { channel="zoneminder:server:server:imageUrl" }
String ZmServer_VideoMonitorId "Video Monitor Id [%s]" { channel="zoneminder:server:server:videoMonitorId" }
String ZmServer_VideoUrl "Video Url [%s]" { channel="zoneminder:server:server:videoUrl" }
String ZmServer_RunState "Run State [%s]" { channel="zoneminder:server:server:runState" }

// Monitor
String      ZM_Monitor1_Id           "Monitor Id [%s]"              { channel="zoneminder:monitor:1:id" }
String      ZM_Monitor1_Name         "Monitor Name [%s]"            { channel="zoneminder:monitor:1:name" }
Image       ZM_Monitor1_Image        "Image [%s]"                   { channel="zoneminder:monitor:1:image" }
Switch      ZM_Monitor1_Enable       "Enable [%s]"                  { channel="zoneminder:monitor:1:enable" }
String      ZM_Monitor1_Function     "Function [%s]"                { channel="zoneminder:monitor:1:function" }
Switch      ZM_Monitor1_Alarm        "Alarm Status [%s]"            { channel="zoneminder:monitor:1:alarm" }
String      ZM_Monitor1_State        "Alarm State [%s]"             { channel="zoneminder:monitor:1:state" }
Switch      ZM_Monitor1_TriggerAlarm "Trigger Alarm [%s]"           { channel="zoneminder:monitor:1:triggerAlarm" }
Number      ZM_Monitor1_HourEvents   "Hour Events [%.0f]"           { channel="zoneminder:monitor:1:hourEvents" }
Number      ZM_Monitor1_DayEvents    "Day Events [%.0f]"            { channel="zoneminder:monitor:1:dayEvents" }
Number      ZM_Monitor1_WeekEvents   "Week Events [%.0f]"           { channel="zoneminder:monitor:1:weekEvents" }
Number      ZM_Monitor1_MonthEvents  "Month Events [%.0f]"          { channel="zoneminder:monitor:1:monthEvents" }
Number      ZM_Monitor1_TotalEvents  "Total Events [%.0f]"          { channel="zoneminder:monitor:1:totalEvents" }
String      ZM_Monitor1_ImageUrl     "Image URL [%s]"               { channel="zoneminder:monitor:1:imageUrl" }
String      ZM_Monitor1_VideoUrl     "Video URL [%s]"               { channel="zoneminder:monitor:1:videoUrl" }
String      ZM_Monitor1_EventId      "Event Id [%s]"                { channel="zoneminder:monitor:1:eventId" }
String      ZM_Monitor1_Event_Name   "Event Name [%s]"              { channel="zoneminder:monitor:1:eventName" }
String      ZM_Monitor1_EventCause   "Event Cause [%s]"             { channel="zoneminder:monitor:1:eventCause" }
DateTime    ZM_Monitor1_EventStart   "Event Start [%s]"             { channel="zoneminder:monitor:1:eventStart" }
DateTime    ZM_Monitor1_EventEnd     "Event End [%s]"               { channel="zoneminder:monitor:1:eventEnd" }
Number      ZM_Monitor1_Frames       "Event Frames [%.0f]"          { channel="zoneminder:monitor:1:eventFrames" }
Number      ZM_Monitor1_AlarmFrames  "Event Alarm Frames [%.0f]"    { channel="zoneminder:monitor:1:eventAlarmFrames" }
Number:Time ZM_Monitor1_Length       "Event Length [%.2f]"          { channel="zoneminder:monitor:1:eventLength" }

Sitemap ​

dsl
Selection item=ZmServer_ImageMonitorId
Image item=ZmServer_ImageUrl
Selection item=ZmServer_VideoMonitorId
Video item=ZmServer_VideoUrl url="" encoding="mjpeg"

Selection item=ZM_Monitor1_Function
Selection item=ZM_Monitor1_Enable
Image item=ZM_Monitor1_Image

Rules ​

The following examples assume you have a motion sensor that is linked to an item called MotionSensorAlarm.

rules
rule "Record When Motion Detected Using Channel"
when
    Item MotionSensorAlarm changed to ON
then
    ZM_TriggerAlarm.sendCommand(ON)
end
rules
rule "Record for 120 Seconds When Motion Detected"
when
    Item MotionSensorAlarm changed to ON
then
    val zmActions = getActions("zoneminder", "zoneminder:monitor:1")
    zmActions.triggerAlarm(120)
end
rules
rule "Record When Motion Detected"
when
    Item MotionSensorAlarm changed to ON
then
    val zmActions = getActions("zoneminder", "zoneminder:monitor:1")
    zmActions.triggerAlarm()
end
rules
rule "Record When Motion Detection Cleared"
when
    Item MotionSensorAlarm changed to OFF
then
    val zmActions = getActions("zoneminder", "zoneminder:monitor:1")
    zmActions.cancelAlarm()
end
rules
val monitors = newArrayList("1", "3", "4", "6")
var int index = 0

rule "Rotate Through a List of Monitor Images Every 10 Seconds"
when
    Time cron "0/10 * * ? * * *"
then
    ZmServer_ImageMonitorId.sendCommand(monitors.get(index))
    index = index + 1
    if (index >= monitors.size) {
        index = 0
    }
end