Skip to content

Commit

Permalink
Convert to bnd build and other changes
Browse files Browse the repository at this point in the history
  • Loading branch information
NorbertHD authored and kaikreuzer committed Sep 6, 2019
1 parent 0ad0f2d commit 3ca9844
Show file tree
Hide file tree
Showing 17 changed files with 156 additions and 103 deletions.
48 changes: 45 additions & 3 deletions bundles/org.openhab.binding.heos/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,49 @@
<?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.8"/>
<classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry excluding="org/openhab/binding/heos/main/" kind="src" path="src/main/java"/>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
14 changes: 2 additions & 12 deletions bundles/org.openhab.binding.heos/.project
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,13 @@
</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>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
73 changes: 38 additions & 35 deletions bundles/org.openhab.binding.heos/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Denon HEOS Binding

This binding support the HEOS-System from Denon. The binding provides control of the players and groups within the network.
It also supports selecting favorites and play them on players or groups within the HEOS-Network.
This binding support the HEOS-System from Denon.
The binding provides control of the players and groups within the network.
It also supports selecting favorites and play them on players or groups within the HEOS-Network.
The binding first establishes a connection to one of the players of the HEOS-Network and use them as a bridge.
After a connection is established, the binding searches for all available players and groups via the bridge.
To keep the network traffic low it is recommended to establish only one connection via one bridge.
Expand All @@ -11,7 +12,7 @@ Connection to the bridge is done via a Telnet connection.

Bridge:
The binding supports a bridge to connect to the HEOS-Network.
A bridge uses the thing ID "bridge"
A bridge uses the thing ID "bridge".


Player:
Expand All @@ -29,32 +30,33 @@ A group uses the thing ID "group"
This binding supports full automatic discovery of available players to be used as a bridge, players and groups (both after establishing a connection via a bridge).
Please note that only one bridge is required to establish a connection.
Adding a second bridge can cause trouble with the connection.
It is recommended to use the PaperUI or other GUI to setup the system and add all players and groups.
It is recommended to use the Paper UI or other GUI to setup the system and add all players and groups.
The bridge is discovered through UPnP in the local network.
Once it is added the players and groups are discovered via the bridge and placed within the inbox.

## Binding Configuration

This binding does not require any configuration.
This binding does not require any configuration.

## Thing Configuration

### Bridge Configuration

The bridge has the following configuration parameter

| Parameter | Description | Required |
|----------------- |----------------------------------------------------------- | --------- |
| ipAddress | The network address of the bridge | yes |
| username | The user name to login to the HEOS account | no |
| password | The password for the HEOS account | no |
| heartbeat | The time in seconds for the HEOS Heartbeat (default = 60s) | no |
| Parameter | Description | Required |
|----------------- |------------------------------------------------------------ | --------- |
| ipAddress | The network address of the bridge | yes |
| username | The user name to login to the HEOS account | no |
| password | The password for the HEOS account | no |
| heartbeat | The time in seconds for the HEOS Heartbeat (default = 60 s) | no |

The password and the user name are used to login to the HEOS account. This is required to load the favorites, playlists and so on from personal settings.
If no login information is provided these features can't be used.
The password and the user name are used to login to the HEOS account.
This is required to load the favorites, playlists and so on from personal settings.
If no login information is provided these features can't be used.

````
Bridge heos:bridge:main "name" [ipAddress="192.168.0.1", unsername="xxx", password="123456"]
Bridge heos:bridge:main "name" [ipAddress="192.168.0.1", unsername="xxx", password="123456"]
````

### Player Configuration
Expand All @@ -68,14 +70,14 @@ Player have the following configuration parameter
For manual configuration a player can be defined as followed:

````
Thing heos:player:pid "name" [pid="123456789"]
Thing heos:player:player1 "name" [pid="123456789"]
````

PID behind the heos:player:--- should be changed as required. Every name or value can be used.
PID behind the heos:player:--- should be changed as required.
It is recommended to use the player PID.
If the PID isn't known it can be discovered by establishing a TelNet connection (port 1255) to one player and search for available players (Command: heos://player/get_players) within the network.
An other way is to use PaperUI to discover the player via the bridge and get the PID.
For further details refer to the [HEOS CLI](http://rn.dmglobal.com/euheos/HEOS_CLI_ProtocolSpecification.pdf) specification.
If the PID isn't known it can be discovered by establishing a Telnet connection (port 1255) to one player and search for available players (Command: heos://player/get_players) within the network.
Another way is to use Paper UI to discover the player via the bridge and get the PID.
For further details refer to the [HEOS CLI](https://rn.dmglobal.com/euheos/HEOS_CLI_ProtocolSpecification.pdf) specification.

### Group Configuration

Expand All @@ -87,12 +89,13 @@ Player have the following configuration parameter


```
Thing heos:group:memberHash "name" [members="45345634;35534567"]
Thing heos:group:group1 "name" [members="45345634;35534567"]
```

### Defining Bridge and Players together

Defining Player and Bridge together. To ensure that the players and groups are attached to the bridge the definition can be like:
Defining Player and Bridge together.
To ensure that the players and groups are attached to the bridge the definition can be like:

```
Bridge heos:bridge:main "Bridge" [ipAddress="192.168.0.1", username="userName", password="123456"] {
Expand Down Expand Up @@ -188,7 +191,7 @@ Player LivingRoom_Control "Control" {channel="heos:player:main:LivingRoom:Contro
| tvaudio |
| phono |

An current list can be found within the HEOS CLI protocol which can be found [here](http://rn.dmglobal.com/euheos/HEOS_CLI_ProtocolSpecification.pdf).
An current list can be found within the HEOS CLI protocol which can be found [here](https://rn.dmglobal.com/euheos/HEOS_CLI_ProtocolSpecification.pdf).

### Channels of Thing type 'bridge'

Expand All @@ -199,7 +202,7 @@ An current list can be found within the HEOS CLI protocol which can be found [he



For a list of the commands please refer to the [HEOS CLI protocol](http://rn.dmglobal.com/euheos/HEOS_CLI_ProtocolSpecification.pdf).
For a list of the commands please refer to the [HEOS CLI protocol](https://rn.dmglobal.com/euheos/HEOS_CLI_ProtocolSpecification.pdf).


## *Dynamic Channels*
Expand All @@ -215,7 +218,7 @@ The player and group channels are only shown on the bridge.
| Channel ID | Item Type | Description |
|------------ |----------- |------------------------------------------------------------------------------------------------------- |
| {mid} | Switch | A channel which represents the favorite. Please check via UI how the correct Channel Type looks like. |

Example

```
Expand All @@ -231,7 +234,7 @@ The player and group channels are only shown on the bridge.
Example

```
Switch Player_1 "Player [%s]" {channel="heos:bridge:main:P123456789"}
Switch Player_1 "Player [%s]" {channel="heos:bridge:main:P123456789"}
```

The {playerUID} has either a P in front of the number which indicates that this is a player or a G to indicate this is a group.
Expand Down Expand Up @@ -289,7 +292,7 @@ If you want to change that for the whole group you have to do it via the group t
### Inputs

To play inputs like the Aux_In it can be played at each player or group.
It is also possible to play an input from an other player at the selected player.
It is also possible to play an input from another player at the selected player.
To do so, first select the player channel of the player where the input is located (source) at the bridge.
Then use the input channel of the player where the source shall be played (destination) to activate the input.

Expand All @@ -303,7 +306,7 @@ Items:
```
Switch HeosBridge_Play_Living "Living Room" (gHeos) {channel="heos:bridge:ed0ac1ff-0193-65c6-c1b8-506137456a50:P918797451"}
String HeosKitchen_Input (gHeos) {channel="heos:player:918797451:Inputs"}
String HeosKitchen_InputSelect "Input" (gHeos)
String HeosKitchen_InputSelect "Input" (gHeos)
```

Rule for kitchen:
Expand All @@ -315,7 +318,7 @@ rule "Play AuxIn from Living Room"
then
if (receivedCommand.toString == "aux_in_1") {
sendCommand(HeosKitchen_Input, "aux_in_1")
} if (receivedCommand.toString == "LivingRoom") {
sendCommand(HeosBridge_Play_Living, ON)
sendCommand(HeosKitchen_Input, "aux_in_1")
Expand Down Expand Up @@ -350,13 +353,13 @@ Then we need a rule which triggers the state if an Item goes Online or Offline.
Rules:

```
rule "Online State Heos Group"
rule "Online State Heos Group"
when
Thing "heos:group:1747557118" changed
Thing "heos:group:1747557118" changed
then
var thingStatus = getThingStatusInfo("heos:group:1747557118")
sendCommand(HeosGroup_Status, thingStatus.getStatus.toString)
sendCommand(HeosGroup_Status, thingStatus.getStatus.toString)
end
```
Expand All @@ -365,20 +368,20 @@ Sitemap:

```
Frame label="Heos Group" visibility=[HeosGroup_Status==ONLINE] {
Default item=HeosGroup1_Player
Default item=HeosGroup1_Volume
Default item=HeosGroup1_Mute
Default item=HeosGroup1_Favorites
Default item=HeosGroup1_Playlist
Text item=HeosGroup1_Song {
Default item=HeosGroup1_Song
Default item=HeosGroup1_Artist
Default item=HeosGroup1_Album
Image item=HeosGroup1_Cover url=""
}
}
```

Expand All @@ -400,4 +403,4 @@ Sitemap:

```
Switch item=HeosKitchen_Playlists mappings=[0="San Glaser", 1="Classic", 2="Beasty Boys"]
```
```
19 changes: 12 additions & 7 deletions bundles/org.openhab.binding.heos/pom.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
<?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/maven-v4_0_0.xsd">
<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">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openhab.binding</groupId>
<artifactId>pom</artifactId>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>2.5.0-SNAPSHOT</version>
</parent>

<groupId>org.openhab.binding</groupId>
<artifactId>org.openhab.binding.heos</artifactId>
<version>2.5.0-SNAPSHOT</version>

<name>Heos Binding</name>
<packaging>eclipse-plugin</packaging>
<name>openHAB Add-ons :: Bundles :: Heos Binding</name>

<dependencies>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.6</version>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
11 changes: 11 additions & 0 deletions bundles/org.openhab.binding.heos/src/main/feature/feature.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.heos-${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/${project.version}/xml/features</repository>

<feature name="openhab-binding-heos" description="Heos Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<feature>openhab-transport-upnp</feature>
<bundle dependency="true">mvn:commons-net/commons-net/3.6</bundle>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.heos/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
package org.openhab.binding.heos.handler;

import static org.openhab.binding.heos.HeosBindingConstants.*;
import static org.openhab.binding.heos.internal.resources.HeosConstants.*;
//import static org.openhab.binding.heos.internal.resources.HeosConstants.*;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -120,11 +120,12 @@ private void scheduledStartUp() {
String name = thing.getConfiguration().get(USERNAME).toString();
String password = thing.getConfiguration().get(PASSWORD).toString();
api.logIn(name, password);
updateState(CH_ID_REBOOT, OnOffType.OFF);
updateStatus(ThingStatus.ONLINE);
} else {
logger.info("Can not log in. Username and Password not set");
logger.debug("Can't log in. Username or password not set.");
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Can't log in. Username or password not set.");
}
updateState(CH_ID_REBOOT, OnOffType.OFF);
updateStatus(ThingStatus.ONLINE);
}, 5, TimeUnit.SECONDS);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
package org.openhab.binding.heos.handler;

import static org.openhab.binding.heos.HeosBindingConstants.*;
import static org.openhab.binding.heos.internal.resources.HeosConstants.*;
//import static org.openhab.binding.heos.internal.resources.HeosConstants.*;

import java.net.MalformedURLException;
import java.net.URL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import java.net.URL;

import org.openhab.binding.heos.internal.resources.HeosConstants;
//import org.openhab.binding.heos.internal.resources.HeosConstants;
import org.openhab.binding.heos.internal.resources.HeosEventListener;

/**
Expand Down
Loading

0 comments on commit 3ca9844

Please sign in to comment.