这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on May 17, 2021. It is now read-only.
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 bundles/action/org.openhab.action.dscalarm/.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="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions bundles/action/org.openhab.action.dscalarm/.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.action.dscalarm</name>
<comment>This is the ${binding-name} action bundle of the open Home Automation Bus (openHAB)</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.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
26 changes: 26 additions & 0 deletions bundles/action/org.openhab.action.dscalarm/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Manifest-Version: 1.0
Private-Package: org.openhab.action.dscalarm.internal
Ignore-Package: org.openhab.action.dscalarm.internal
Bundle-License: http://www.eclipse.org/legal/epl-v10.html
Bundle-Name: openHAB DSC Alarm Action
Bundle-SymbolicName: org.openhab.action.dscalarm
Bundle-Vendor: openHAB.org
Bundle-Version: 1.8.0.qualifier
Bundle-Activator: org.openhab.action.dscalarm.internal.DSCAlarmActivator
Bundle-ManifestVersion: 2
Bundle-Description: This is the DSC Alarm action of the open Home Automation Bus (openHAB)
Import-Package: org.openhab.core.items,
org.openhab.core.library.items,
org.openhab.core.library.types,
org.openhab.core.scriptengine.action,
org.openhab.core.types,
org.osgi.framework,
org.osgi.service.cm,
org.osgi.service.component,
org.slf4j,
org.openhab.binding.dscalarm
Bundle-DocURL: http://www.openhab.org
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Service-Component: OSGI-INF/action.xml
Bundle-ClassPath: .
Bundle-ActivationPolicy: lazy
24 changes: 24 additions & 0 deletions bundles/action/org.openhab.action.dscalarm/OSGI-INF/action.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2010-2015, openHAB.org and others.

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" activate="activate" deactivate="deactivate" immediate="true" name="org.openhab.action.dscalarm.action">
<implementation class="org.openhab.action.dscalarm.internal.DSCAlarmActionService" />

<service>
<provide interface="org.openhab.core.scriptengine.action.ActionService" />
<provide interface="org.osgi.service.cm.ManagedService" />
</service>

<property name="service.pid" type="String" value="org.openhab.dscalarm.action" />

<reference bind="setDSCAlarmActionProvider" cardinality="1..1" interface="org.openhab.binding.dscalarm.DSCAlarmActionProvider" name="DSCAlarmActionProvider" policy="static" unbind="resetDSCAlarmActionProvider"/>

</scr:component>
87 changes: 87 additions & 0 deletions bundles/action/org.openhab.action.dscalarm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Documentation for the DSC Alarm Action Bundle

## Introduction

This bundle exposes openHAB Rule extensions to be used with the [DSC Alarm Binding](https://github.com/openhab/openhab/wiki/DSC-Alarm-Binding).

It allows the sending of DSC Alarm specific commands from within [openHAB Rules](https://github.com/openhab/openhab/wiki/Rules):

## Releases

* 1.8.0 - First release

## Configuration

The DSC Alarm Action bundle relies on the DSC Alarm Binding being installed and configured, along with the installation of the DSC Alarm Action Bundle (JAR) file.

## Extensions

Currently the DSC Alarm Action Bundle supports a single rule extension with the following formats:

* `sendDSCAlarmCommand(String command)` - sends a DSC Alarm command.
* `sendDSCAlarmCommand(String command, String data)` - same as above but with command specific required data.

The 'command' parameter is a string numeric code. The following table shows which commands are supported:

<table>
<tr><td><b>DSC Alarm Command Code</b></td><td><b>Description</b></td><td><b>Data</b></td><td><b>Supported Interface</b></td></tr>
<tr><td>'000'</td><td>Poll</td><td>NONE</td><td>Envisalink, IT100</td></tr>
<tr><td>'001'</td><td>Status Report</td><td>NONE</td><td>Envisalink, IT100</td></tr>
<tr><td>'002'</td><td>Labels Request</td<td>NONE</td><td>IT100</td></tr>
<tr><td>'005'</td><td>Network Login</td><td>1-6 Character - [Password]</td><td>Envisalink</td></tr>
<tr><td>'008'</td><td>Dump Zone Timers</td><td>NONE</td><td>Envisalink</td></tr>
<tr><td>'010'</td><td>Set Time and Date</td><td>NONE</td><td>Envisalink, IT100</td></tr>
<tr><td>'020'</td><td>Command Output Control</td><td>2 Characters - [Partition # (1-8)][PGM # (1-4)]</td><td>Envisalink, IT100</td></tr>
<tr><td>'030'</td><td>Partition Arm Control - Away</td><td>1 Character - [Partition # (1-8)]</td><td>Envisalink, IT100</td></tr>
<tr><td>'031'</td><td>Partition Arm Control - Stay</td><td>1 Character - [Partition # (1-8)]</td><td>Envisalink, IT100</td></tr>
<tr><td>'032'</td><td>Partition Arm Control - No Entry Delay</td><td>1 Character - [Partition # (1-8)]</td><td>Envisalink, IT100</td></tr>
<tr><td>'033'</td><td>Partition Arm Control - With User Code</td><td>5-7 Characters - [Partition # (1-8)][User Code (4-6)]</td><td>Envisalink, IT100</td></tr>
<tr><td>'040'</td><td>Partition Disarm Control - With User Code</td><td>5-7 Characters - [Partition # (1-8)][User Code (4-6)]</td><td>Envisalink, IT100</td></tr>
<tr><td>'055'</td><td>Time Stamp Control</td><td>1 Character - [On/Off (1,0)]</td><td>Envisalink, IT100</td></tr>
<tr><td>'056'</td><td>Time/Date Broadcast Control</td><td>1 Character - [On/Off (1,0)]</td><td>Envisalink, IT100</td></tr>
<tr><td>'057'</td><td>Temperature Broadcast Control</td><td>1 Character - [On/Off (1,0)]</td><td>Envisalink, IT100</td></tr>
<tr><td>'058'</td><td>Virtual Keypad Control</td><td>1 Character - [On/Off (1,0)]</td><td>IT100</td></tr>
<tr><td>'060'</td><td>Trigger Panic Alarm</td><td>1 Character - [1=Fire, 2=Ambulance, 3=Police]</td><td>Envisalink, IT100</td></tr>
<tr><td>'070'</td><td>Single Keystroke</td><td>1 Character - [Single ASCII Character]</td><td>Envisalink, IT100</td></tr>
<tr><td>'071'</td><td>Keystroke String</td><td>1-6 Characters - [1-6 ASCII Character String]</td><td>Envisalink</td></tr>
<tr><td>'074'</td><td>Keep Alive</td><td>1 Character - [Partition # (1-8)]</td><td>Envisalink</td></tr>
<tr><td>'200'</td><td>Code Send</td><td>4-6 Characters - [User Code (4-6)]</td><td>Envisalink, IT100</td></tr>
</table>

## Examples

To invoke the action see the examples below:

Add an item to your items file such as a switch:

```
Switch PollCommand "Send a poll command to the DSC Alarm System"
```

The following rule will trigger whenever the switch is turned ON:

```
rule "PollCommand"
when
Item PollCommand received command ON
then
sendDSCAlarmCommand("000")
end
```

Again add an item to your items file:

```
Switch BypassZone1 "Bypass Zone 1"
```

This rule triggers when the switch is turned ON:

```
rule "BypassZone1"
when
Item BypassZone1 received command ON
then
sendDSCAlarmCommand("071","*101#")
end
```
6 changes: 6 additions & 0 deletions bundles/action/org.openhab.action.dscalarm/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/main/java/,\
src/main/resources/
bin.includes = META-INF/,\
.,\
OSGI-INF/
output.. = target/classes/
35 changes: 35 additions & 0 deletions bundles/action/org.openhab.action.dscalarm/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<parent>
<groupId>org.openhab.bundles</groupId>
<artifactId>action</artifactId>
<version>1.8.0-SNAPSHOT</version>
</parent>

<properties>
<bundle.symbolicName>org.openhab.action.dscalarm</bundle.symbolicName>
<bundle.namespace>org.openhab.action.dscalarm</bundle.namespace>
<deb.name>openhab-addon-action-dscalarm</deb.name>
<deb.description>${project.name}</deb.description>
</properties>

<modelVersion>4.0.0</modelVersion>
<groupId>org.openhab.action</groupId>
<artifactId>org.openhab.action.dscalarm</artifactId>

<name>openHAB DSC Alarm Action</name>

<packaging>eclipse-plugin</packaging>

<build>
<plugins>
<plugin>
<groupId>org.vafer</groupId>
<artifactId>jdeb</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* Copyright (c) 2010-2015, openHAB.org and others.
*
* 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
*/
package org.openhab.action.dscalarm.internal;

import org.openhab.binding.dscalarm.DSCAlarmActionProvider;
import org.openhab.core.scriptengine.action.ActionDoc;
import org.openhab.core.scriptengine.action.ParamDoc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* This class provides static methods, for the DSC Alarm, that can be used in automation rules.
*
* @author Russell Stephens
* @since 1.8.0
*/
public class DSCAlarmAction {
private static Logger logger = LoggerFactory.getLogger(DSCAlarmAction.class);

/**
* Sends a string that is equivalent to a key sequence on an existing keypad.
*/
@ActionDoc(text = "Sends a DSC Alarm command that required no extra data.")
public static boolean sendDSCAlarmCommand(
@ParamDoc(name = "command", text = "The command to be sent to the DSC Alarm.") String command ) {

return sendDSCAlarmCommandInternal(command, "");
}

@ActionDoc(text = "Sends a DSC Alarm command along with required data.")
public static boolean sendDSCAlarmCommand(
@ParamDoc(name = "command", text = "The command to be sent to the DSC Alarm.") String command,
@ParamDoc(name = "data", text = "The data string for the command.") String data) {

return sendDSCAlarmCommandInternal(command, data);
}

private static DSCAlarmActionProvider getDSCAlarmActionProvider() throws Exception {
DSCAlarmActionService actionService = DSCAlarmActionService.getDSCAlarmActionService();

if (actionService == null) {
throw new Exception(String.format("DSC Alarm Action Service is not configured!"));
}

DSCAlarmActionProvider actionProvider = actionService.getDSCAlarmActionProvider();

if (actionProvider == null) {
throw new Exception(String.format("DSC Alarm Action Service is not configured!"));
}

return actionProvider;
}

private static boolean sendDSCAlarmCommandInternal(String command, String data) {

try {
logger.debug("sendDSCAlarmCommandInternal(): Sending DSC Alarm command!");

DSCAlarmActionProvider actionProvider = getDSCAlarmActionProvider();

return actionProvider.sendDSCAlarmCommand(command, data);

} catch (Exception e) {
logger.error("sendDSCAlarmCommandInternal(): Error Sending DSC Alarm Command: {}", e);
}

return false;
}
}

Loading