Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial contribution of ZoneMinder Binding #1812

Merged
merged 1 commit into from
Feb 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions addons/binding/org.openhab.binding.zoneminder/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="lib" path="lib/zoneminder4j-0.9.7.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions addons/binding/org.openhab.binding.zoneminder/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.openhab.binding.zoneminder</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<binding:binding id="zoneminder"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:binding="http://eclipse.org/smarthome/schemas/binding/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/binding/v1.0.0 http://eclipse.org/smarthome/schemas/binding-1.0.0.xsd">
<name>ZoneMinder Binding</name>
<description>This binding interfaces a ZoneMinder Server</description>
<author>Martin S. Eskildsen</author>
</binding:binding>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<config-description:config-descriptions
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:config-description="http://eclipse.org/smarthome/schemas/config-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/config-description/v1.0.0
http://eclipse.org/smarthome/schemas/config-description-1.0.0.xsd">
<config-description uri="thing-type:monitor-channels:config">
<parameter name="monitorId" type="integer" required="true">
<label>Monitor ID</label>
<description>The ID of the monitor in ZoneMinder</description>
</parameter>
<parameter name="monitorTriggerTimeout" type="integer" required="false" min="0" max="65335">
<label>ForceAlarm timeout</label>
<description>Timeout in seconds when activating alarm. Default is 60 seconds</description>
<default>60</default>
</parameter>
<parameter name="monitorEventText" type="text" required="false" >
<label>Event Text</label>
<description>Event text in ZoneMinder</description>
<default>Triggered from openHAB</default>
</parameter>
</config-description>
</config-description:config-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<config-description:config-descriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:config-description="http://eclipse.org/smarthome/schemas/config-description/v1.0.0" xsi:schemaLocation="http://eclipse.org/smarthome/schemas/config-description/v1.0.0
http://eclipse.org/smarthome/schemas/config-description-1.0.0.xsd">
<config-description uri="thing-type:zoneminderserver:config">
<parameter-group name="basic">
<context>basic</context>
<label>Basic</label>
</parameter-group>
<parameter-group name="credentials">
<context>credentials</context>
<label>Credentials</label>
</parameter-group>
<parameter-group name="network">
<context>network</context>
<label>Port configuration</label>
</parameter-group>
<parameter-group name="refreshConfig">
<context>refreshConfig</context>
<label>Refresh settings</label>
</parameter-group>
<parameter-group name="advancedSettings">
<context>advancedSettings</context>
<label>Advanced</label>
</parameter-group>
<parameter name="hostname" type="text" required="true" groupName="basic">
<context>network-address</context>
<label>Host</label>
<description>The IP address or hostname of the ZoneMinder Server</description>
</parameter>
<parameter name="protocol" type="text" required="false" groupName="basic">
<label>Protocol</label>
<description>Protocol to connect to the ZoneMinder Server API (http or https)</description>
<default>http</default>
<options>
<option value="http">HTTP</option>
<option value="https">HTTPS</option>
</options>
</parameter>
<parameter name="urlpath" type="text" required="false" groupName="basic">
<label>Additional path on ZoneMinder Server to access API</label>
<description>Additional path on ZoneMinder Server to access API. In a standard installation this is' /zm'</description>
<default>/zm</default>
</parameter>
<parameter name="user" type="text" required="false" groupName="credentials">
<label>Username</label>
<description>User to access the ZoneMinder Server API</description>
</parameter>
<parameter name="password" type="text" required="false" groupName="credentials">
<context>password</context>
<label>Password</label>
<description>Password to access the ZoneMinder Server API</description>
</parameter>
<parameter name="http_port" type="integer" required="false" min="0" max="65335" groupName="network">
<label>Port</label>
<description>Port of the ZoneMinder Server API. If '0', then the port will be determined from the protocol</description>
<default>0</default>
<advanced>true</advanced>
</parameter>
<parameter name="telnet_port" type="integer" required="false" min="1" max="65335" groupName="network">
<label>Telnet Port</label>
<description>Port to listen for events in (Telnet)</description>
<default>6802</default>
<advanced>true</advanced>
</parameter>
<parameter name="refresh_interval" type="integer" required="false" min="1" max="65335" groupName="refreshConfig">
<label>API Polling interval</label>
<description>Seconds between each call to ZoneMinder Server API to refresh values in openHAB</description>
<default>10</default>
<advanced>true</advanced>
</parameter>
<parameter name="refresh_interval_disk_usage" type="integer" required="false" min="0" max="65335" groupName="refreshConfig">
<label>Refresh Interval for Disk Usage</label>
<description>Minutes between each call to ZoneMinder Server to refresh Server DiskUsage in ZoneMinder. Default value is '0' (Disabled)</description>
<default>0</default>
<advanced>true</advanced>
</parameter>
<parameter name="autodiscover_things" type="boolean" required="false" groupName="advanced">
<label>Background discovery</label>
<description>If enabled new monitors on the ZoneMinder Server will automatically be added to the Inbox in openHAB</description>
<default>true</default>
<advanced>true</advanced>
</parameter>
</config-description>
</config-description:config-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="zoneminder" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<!-- Supported ZoneMinder devices and features -->
<thing-type id="monitor">
<supported-bridge-type-refs>
<bridge-type-ref id="server" />
</supported-bridge-type-refs>

<label>ZoneMinder Monitor</label>
<description>Camera in ZoneMinder</description>

<channels>
<channel id="online" typeId="monitor_online" />
<channel id="enabled" typeId="monitor_enabled" />
<channel id="force-alarm" typeId="monitor_force_alarm" />
<channel id="alarm" typeId="monitor_alarm" />
<channel id="recording" typeId="monitor_recording" />
<channel id="detailed-status" typeId="monitor_detailed_status" />
<channel id="function" typeId="monitor_function" />
<channel id="event-cause" typeId="monitor_event_cause" />
<channel id="capture-daemon" typeId="monitor_zmc_daemon" />
<channel id="analysis-daemon" typeId="monitor_zma_daemon" />
<channel id="frame-daemon" typeId="monitor_zmf_daemon" />
</channels>

<config-description-ref uri="thing-type:monitor-channels:config" />
</thing-type>

<!-- Channel definitions of ZoneMinder Server -->
<channel-type id="monitor_online">
<item-type>Switch</item-type>
<label>Online</label>
<description>Switch telling if the monitor is online</description>
<state readOnly="true" />
</channel-type>

<channel-type id="monitor_enabled">
<item-type>Switch</item-type>
<label>Enabled</label>
<description>Showing the value of the checkbox 'enabled' in ZoneMinder for the monitor</description>
<state readOnly="false" />
</channel-type>

<channel-type id="monitor_force_alarm">
<item-type>Switch</item-type>
<label>Force Alarm</label>
<description>Will force an alarm from openHAB in ZoneMinder</description>
<state readOnly="false" />
</channel-type>


<channel-type id="monitor_alarm">
<item-type>Switch</item-type>
<label>Alarm status</label>
<description>set to 'ON' when one of the following is true: Motion detected, Signal lost, Force Alarm pressed, External Alarm. Else set to 'OFF'</description>
<state readOnly="true" />
</channel-type>

<channel-type id="monitor_recording">
<item-type>Switch</item-type>
<label>Recording status</label>
<description>set to 'ON' when either channel monitor-alarm set to 'ON', or montior function is 'Mocord' or 'Record'. Else set to 'OFF'</description>
<state readOnly="true" />
</channel-type>

<channel-type id="monitor_detailed_status" advanced="true">
<item-type>String</item-type>
<label>Detailed Status</label>
<description>Current Monitor Status: 0=Idle, 1=Pre-alarm, 2=Alarm, 3=Alert, 4=Recording</description>
<state pattern="%s" readOnly="true">
<options>
<option value="Idle">Idle</option>
<option value="Pre-alarm">Pre-alarm</option>
<option value="Alarm">Alarm</option>
<option value="Alert">Alert</option>
<option value="Recording">Recording</option>
</options>
</state>
</channel-type>

<channel-type id="monitor_function" advanced="true">
<item-type>String</item-type>
<label>Operating mode</label>
<description>Current Monitor Function: None, Monitor, Modect, Record, Mocord, Nodect</description>
<state pattern="%s" readOnly="false">
<options>
<option value="None">None</option>
<option value="Monitor">Monitor</option>
<option value="Modect">Modect</option>
<option value="Record">Record</option>
<option value="Mocord">Mocord</option>
<option value="Nodect">Nodect</option>
</options>
</state>

</channel-type>

<channel-type id="monitor_event_cause" advanced="true">
<item-type>String</item-type>
<label>Event Cause</label>
<description>Cause of event: None, Signal, Motion, Forced Web, openHAB, Other</description>
<state pattern="%s" readOnly="true">
<options>
<option value="none">None</option>
<option value="signal">Signal</option>
<option value="motion">Motion</option>
<option value="forced_web">Forced Web</option>
<option value="openhab">openHAB</option>
<option value="other">Other</option>
</options>
</state>
</channel-type>

<channel-type id="monitor_zmc_daemon" advanced="true">
<item-type>Switch</item-type>
<label>zmc daemon Status</label>
<description>State of ZoneMinder Capture daemon for this monitor</description>
<state readOnly="true"/>
</channel-type>

<channel-type id="monitor_zma_daemon" advanced="true">
<item-type>Switch</item-type>
<label>zma daemon Status</label>
<description>State of ZoneMinder Analysis daemon for this monitor</description>
<state readOnly="true"/>
</channel-type>

<channel-type id="monitor_zmf_daemon" advanced="true">
<item-type>Switch</item-type>
<label>zmf daemon Status</label>
<description>State of ZoneMinder Frame daemon for this monitor</description>
<state readOnly="true"/>
</channel-type>

</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="zoneminder"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 org.eclipse.smarthome.thing-description.xsd">

<bridge-type id="server">
<label>ZoneMinder Server</label>
<description>ZoneMinder Server</description>
<channels>
<channel id="online" typeId="server_online" />
<channel id="cpu-load" typeId="server_cpu_load"/>
<channel id="disk-usage" typeId="server_disk_usage"/>
</channels>

<config-description-ref uri="thing-type:zoneminderserver:config"/>
</bridge-type>

<channel-type id="server_online">
<item-type>Switch</item-type>
<label>Online</label>
<description>ZoneMinder Server Online Status</description>
<state readOnly="true"/>
</channel-type>

<channel-type id="server_cpu_load">
<item-type>Number</item-type>
<label>CPU load</label>
<description>ZoneMinder Server CPU Load</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="server_disk_usage">
<item-type>Number</item-type>
<label>Diskusage</label>
<description>ZoneMinder Server Disk Usage</description>
<state readOnly="true"/>
</channel-type>

</thing:thing-descriptions>
34 changes: 34 additions & 0 deletions addons/binding/org.openhab.binding.zoneminder/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ZoneMinder Binding
Bundle-SymbolicName: org.openhab.binding.zoneminder;singleton:=true
Bundle-Vendor: openHAB
Bundle-Version: 2.1.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ClassPath: .,
lib/gson-2.7.jar,
lib/guava-17.0.jar,
lib/jersey-common-2.4.1.jar,
lib/javax.ws.rs-api-2.0.1.jar,
lib/jsoup-1.10.1.jar,
lib/zoneminder4j-0.9.7.jar
Import-Package:
com.google.common.collect,
javax.ws.rs.client,
javax.ws.rs.core,
org.apache.commons.net.util,
org.eclipse.smarthome.config.core,
org.eclipse.smarthome.config.discovery,
org.eclipse.smarthome.core.library.types,
org.eclipse.smarthome.core.thing,
org.eclipse.smarthome.core.thing.binding,
org.eclipse.smarthome.core.thing.binding.builder,
org.eclipse.smarthome.core.thing.type,
org.eclipse.smarthome.core.types,
org.openhab.binding.zoneminder,
org.openhab.binding.zoneminder.handler,
org.osgi.framework,
org.slf4j
Service-Component: OSGI-INF/*.xml
Export-Package: org.openhab.binding.zoneminder,
org.openhab.binding.zoneminder.handler
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2014-2016 by the respective copyright holders.

All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html

-->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="binding.zoneminder">

<implementation class="org.openhab.binding.zoneminder.internal.ZoneMinderHandlerFactory"/>

<service>
<provide interface="org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory"/>
</service>

</scr:component>
Loading