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

[OmniLink] Binding Initial Contribution #8922

Merged
merged 1 commit into from
Jan 19, 2021
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
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
/bundles/org.openhab.binding.oceanic/ @kgoderis
/bundles/org.openhab.binding.ojelectronics/ @EvilPingu
/bundles/org.openhab.binding.omnikinverter/ @hansbogert
/bundles/org.openhab.binding.omnilink/ @ecdye
/bundles/org.openhab.binding.onebusaway/ @sdwilsh
/bundles/org.openhab.binding.onewire/ @J-N-K
/bundles/org.openhab.binding.onewiregpio/ @aogorek
Expand Down
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,11 @@
<artifactId>org.openhab.binding.omnikinverter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.omnilink</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.onebusaway</artifactId>
Expand Down
20 changes: 20 additions & 0 deletions bundles/org.openhab.binding.omnilink/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
This content is produced and maintained by the openHAB project.

* Project home: https://www.openhab.org

== Declared Project Licenses

This program and the accompanying materials are made available under the terms
of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.

== Source Code

https://github.com/openhab/openhab-addons

== Third-party Content

jomnilink
* License: EPL-2.0
* Project: https://github.com/digitaldan/jomnilink
* Source: https://github.com/digitaldan/jomnilink
321 changes: 321 additions & 0 deletions bundles/org.openhab.binding.omnilink/README.md

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions bundles/org.openhab.binding.omnilink/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>3.1.0-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.binding.omnilink</artifactId>

<name>openHAB Add-ons :: Bundles :: OmniLink Binding</name>

<dependencies>
<dependency>
<groupId>com.github.digitaldan</groupId>
<artifactId>jomnilink</artifactId>
<version>1.4.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2010-2021 Contributors to the openHAB project

See the NOTICE file(s) distributed with this work for additional
information.

This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0

SPDX-License-Identifier: EPL-2.0

-->
<features name="org.openhab.binding.omnilink-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>

<feature name="openhab-binding-omnilink" description="OmniLink Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.omnilink/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* Copyright (c) 2010-2021 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.omnilink.internal;

import static org.openhab.binding.omnilink.internal.OmnilinkBindingConstants.*;

import java.math.BigInteger;

import org.eclipse.jdt.annotation.NonNullByDefault;

/**
* The {@link AreaAlarm} class defines the different types of alarms supported
* by the OmniLink Protocol.
*
* @author Craig Hamilton - Initial contribution
*/
@NonNullByDefault
public enum AreaAlarm {
BURGLARY(CHANNEL_AREA_ALARM_BURGLARY, 0),
FIRE(CHANNEL_AREA_ALARM_FIRE, 1),
GAS(CHANNEL_AREA_ALARM_GAS, 2),
AUXILIARY(CHANNEL_AREA_ALARM_AUXILIARY, 3),
FREEZE(CHANNEL_AREA_ALARM_FREEZE, 4),
WATER(CHANNEL_AREA_ALARM_WATER, 5),
DURESS(CHANNEL_AREA_ALARM_DURESS, 6),
TEMPERATURE(CHANNEL_AREA_ALARM_TEMPERATURE, 7);

private final String channelUID;
private final int bit;

AreaAlarm(String channelUID, int bit) {
this.channelUID = channelUID;
this.bit = bit;
}

public boolean isSet(BigInteger alarmBits) {
return alarmBits.testBit(bit);
}

public boolean isSet(int alarmBits) {
return isSet(BigInteger.valueOf(alarmBits));
}

public String getChannelUID() {
return channelUID;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* Copyright (c) 2010-2021 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.omnilink.internal;

import java.util.Arrays;
import java.util.Optional;

import org.eclipse.jdt.annotation.NonNullByDefault;

/**
* The {@link AudioPlayer} defines some methods that are used to
* interface with an OmniLink Audio Player.
*
* @author Brian O'Connell - Initial contribution
*/
@NonNullByDefault
public enum AudioPlayer {
NUVO(1, 6, 8, 7, 9, 10),
NUVO_GRAND_ESSENTIA_SIMPLESE(2, 6, 8, 7, 9, 10),
NUVO_GRAND_GRAND_CONCERTO(3, 6, 6, 6, 9, 10),
RUSSOUND(4, 6, 8, 7, 11, 12),
XANTECH(6, 13, 15, 14, 16, 17),
SPEAKERCRAFT(7, 45, 44, 46, 42, 43),
PROFICIENT(8, 45, 44, 46, 42, 43);

private final int featureCode;
private final int playCommand;
private final int pauseCommand;
private final int stopCommand;
private final int previousCommand;
private final int nextCommand;

AudioPlayer(int featureCode, int playCommand, int pauseCommand, int stopCommand, int previousCommand,
int nextCommand) {
this.featureCode = featureCode;
this.playCommand = playCommand;
this.pauseCommand = pauseCommand;
this.stopCommand = stopCommand;
this.previousCommand = previousCommand;
this.nextCommand = nextCommand;
}

public int getPlayCommand() {
return playCommand;
}

public int getPauseCommand() {
return pauseCommand;
}

public int getStopCommand() {
return stopCommand;
}

public int getPreviousCommand() {
return previousCommand;
}

public int getNextCommand() {
return nextCommand;
}

public static Optional<AudioPlayer> getAudioPlayerForFeatureCode(int featureCode) {
return Arrays.stream(values()).filter(v -> v.featureCode == featureCode).findAny();
}
}
Loading