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

[volumio] Initial contribution #14525

Merged
merged 29 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4bba60a
initial commit to official addon repo
miloit Mar 3, 2023
022283b
sign off
miloit Mar 3, 2023
2ad27bb
Signed-off-by: miloit <[email protected]>
miloit Mar 3, 2023
c02fe1d
Readme update
miloit Mar 4, 2023
2931287
Improved code
miloit Mar 4, 2023
5e4db31
Introducing Nullable class annotation to all classes
miloit Mar 4, 2023
c93231d
Update Readme file
miloit Mar 5, 2023
0ff0525
Improved coding to avoid null pointer exceptions. Renaming thing to v…
miloit Mar 5, 2023
d9dfb9a
Update bundles/org.openhab.binding.volumio/pom.xml
miloit Mar 10, 2023
47a260e
Update .gitignore
miloit Mar 10, 2023
eb7f327
Signed-off-by: miloit <[email protected]>
miloit Mar 10, 2023
c4f3a90
Adding binding to the offical repo
miloit Mar 10, 2023
103a380
fix issues with pom.xml
miloit Mar 11, 2023
8d4ba63
Fixing Headers in File
miloit Mar 11, 2023
7a23290
Solving last errors after the grashed commit.
miloit Mar 11, 2023
762d483
Closing code style issues
miloit Mar 11, 2023
32a4321
Removed org.apache.commons.io.IOUtils
miloit Mar 11, 2023
b122da0
Resolved all code style issues
miloit Mar 11, 2023
ee48cc4
Changes of review
miloit Mar 11, 2023
43c7803
Update german translation
miloit Mar 11, 2023
0581b2a
commit after review
miloit Mar 11, 2023
d735193
review changes done
miloit Mar 12, 2023
3261d79
change to new code convention
miloit Apr 24, 2023
f339134
updtaed formatting
miloit Jun 18, 2023
27d6c10
Signed-off-by: miloit <[email protected]>
miloit Jul 6, 2023
52b98b3
Signed-off-by: miloit <[email protected]>
miloit Jul 6, 2023
0ba7285
Signed-off-by: miloit <[email protected]>
miloit Jul 7, 2023
81f3d94
Signed-off-by: miloit <[email protected]>
miloit Jul 7, 2023
be204d6
Signed-off-by: miloit <[email protected]>
miloit Jul 7, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@
/bundles/org.openhab.binding.yamahareceiver/ @davidgraeff @zarusz
/bundles/org.openhab.binding.yeelight/ @claell
/bundles/org.openhab.binding.yioremote/ @miloit
/bundles/org.openhab.binding.volumio/ @miloit
/bundles/org.openhab.binding.zoneminder/ @mhilbush
/bundles/org.openhab.binding.zway/ @pathec
/bundles/org.openhab.io.homekit/ @andylintner @ccutrer @yfre
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 @@ -1796,6 +1796,11 @@
<artifactId>org.openhab.binding.volvooncall</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.volumio</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.warmup</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions bundles/org.openhab.binding.volumio/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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
101 changes: 101 additions & 0 deletions bundles/org.openhab.binding.volumio/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Volumio Binding

This binding integrates the open-source Music Player [Volumio](https://www.volumio.com).

## Supported Things


All available Volumio (playback) modes are supported by this binding.

## Discovery

The Volumio devices are discovered through mDNS in the local network and all devices are put in the Inbox.


## Binding Configuration

The binding has the following configuration options, which can be set:

| Parameter | Name | Description | Required |
| ----------- | ---------------- | -------------------------------------------------------------------------- | -------- |
| hostname | Hostname | The hostname of the Volumio player. | yes |
| port | Port | The port of your volumio2 device (default is 3000) | yes |
| protocol | Protocol | The protocol of your volumio2 device (default is http) | yes |
| timeout | Timeout | Connection-Timeout in ms | no |


## Thing Configuration

The Volumio Thing requires the hostname, port and protocol as a configuration value in order for the binding to know how to access it.
Additionally, a connection timeout (in ms) can be configured.
In the thing file, this looks e.g. like

```java
Thing volumio:player:VolumioLivingRoom "Volumio" @ "Living Room" [hostname="volumio.local", protocol="http"]
```

### `sample` Thing Configuration

| Name | Type | Description | Default | Required | Advanced |
|-----------------|---------|---------------------------------------|---------|----------|----------|
| hostname | text | The hostname of the Volumio player. | N/A | yes | no |
| port | text | The port of your Volumio device. | 3000 | yes | no |
| protocol | text | The protocol of your Volumio device. | http | yes | no |
| timeout | integer | Connection-Timeout in ms. | 5000 | no | yes |

## Channels

The devices support the following channels:


| Channel | Type | Read/Write | Description |
|-------------------|--------|------------|----------------------------------------------------------------------------------------------------------------------|
| title | String | R | Title of the song currently playing. |
| artist | String | R | Name of the artist currently playing. |
| album | String | R | Name of the album currently playing. |
| volume | Dimmer | RW | Set or get the master volume. |
| player | Player | RW | The State channel contains state of the Volumio Player. |
| albumArt | Image | R | Cover Art for the currently played track. |
| track-type | String | R | Tracktype of the currently played track. |
| play-radiostream | String | RW | Play the given radio stream. |
| play-playlist | String | RW | Playback a playlist identified by its name. |
| clear-queue | Switch | RW | Clear the current queue. |
| play-uri | Switch | RW | Play the stream at given uri. |
| play-file | Switch | RW | Play a file, located on your Volumio device at the given absolute path, e.g."mnt/INTERNAL/song.mp3" |
| random | Switch | RW | Activate random mode. |
| repeat | Switch | RW | Activate repeat mode. |
| system-command | Switch | RW | Sends a system command to Volumio. This allows to shutdown/reboot Volumio. Use "Shutdown"/"Reboot" as String command.|
| stop-command | Switch | RW | Sends a Stop Command to Volumio. This allows to stop the player. Use "stop" as string command. |


## Full Example

demo.things:

```java
Thing volumio:player:VolumioLivingRoom "Volumio" @ "Living Room" [hostname="volumio.local", protocol="http"]
```

demo.items:

```java
String Volumio_CurrentTitle "Current Title [%s]" <musicnote> {channel="volumio:player:VolumioLivingRoom:title"}
String Volumio_CurrentArtist "Current Artist [%s]" {channel="volumio:player:VolumioLivingRoom:artist"}
String Volumio_CurrentAlbum "Current Album [%s]" {channel="volumio:player:VolumioLivingRoom:album"}
Dimmer Volumio_CurrentVolume "Current Volume [%.1f %%]" <soundvolume> {channel="volumio:player:VolumioLivingRoom:volume"}
Player Volumio "Current Status [%s]" <volumiologo> {channel="volumio:player:VolumioLivingRoom:player"}
String Volumio_CurrentTrackType "Current Track Type [%s]" <musicnote> {channel="volumio:player:VolumioLivingRoom:track-type"}
miloit marked this conversation as resolved.
Show resolved Hide resolved
```

demo.sitemap:

```perl
sitemap demo label="Main Menu"
{
Frame label="Volumio" {
Slider item=Volumio_CurrentVolume
Text item=Volumio
Text item=Volumio_CurrentTitle
miloit marked this conversation as resolved.
Show resolved Hide resolved
}
}
```
51 changes: 51 additions & 0 deletions bundles/org.openhab.binding.volumio/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?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 https://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>4.0.0-SNAPSHOT</version>
</parent>

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

<name>openHAB Add-ons :: Bundles :: Volumio Binding</name>
<properties>
<bnd.importpackage>org.apache.http.*;io.socket.thread;io.socket.engineio.client;io.socket.emitter;android.*;resolution:=optional,com.android.org.*;resolution:=optional,dalvik.*;resolution:=optional,javax.annotation.meta.*;resolution:=optional,org.apache.harmony.*;resolution:=optional,org.conscrypt.*;resolution:=optional,sun.security.*;resolution:=optional</bnd.importpackage>
</properties>
<dependencies>
<dependency>
<groupId>org.openhab.osgiify</groupId>
<artifactId>io.socket.socket.io-client</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openhab.osgiify</groupId>
<artifactId>io.socket.engine.io-client</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.okhttp</artifactId>
<version>3.8.1_1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.okio</artifactId>
<version>1.13.0_1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20230227</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.volumio-${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-volumio" description="Volumio Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.volumio/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* Copyright (c) 2010-2023 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.volumio.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.ThingTypeUID;

/**
* The {@link VolumioBindingConstants} class defines common constants, which are
* used across the whole binding.
*
* @author Patrick Sernetz - Initial Contribution
* @author Chris Wohlbrecht - Adaption for openHAB 3
* @author Michael Loercher - Adaption for openHAB 3
*/
@NonNullByDefault
public class VolumioBindingConstants {

private static final String BINDING_ID = "volumio";

// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_VOLUMIO = new ThingTypeUID(BINDING_ID, "player");

// List of all Channel ids
public static final String CHANNEL_TITLE = "title";
public static final String CHANNEL_ARTIST = "artist";
public static final String CHANNEL_ALBUM = "album";
public static final String CHANNEL_VOLUME = "volume";
public static final String CHANNEL_PLAYER = "player";
public static final String CHANNEL_COVER_ART = "album-art";
public static final String CHANNEL_TRACK_TYPE = "track-type";
public static final String CHANNEL_PLAY_RADIO_STREAM = "play-radiostream";
public static final String CHANNEL_PLAY_PLAYLIST = "play-playlist";
public static final String CHANNEL_CLEAR_QUEUE = "clear-queue";
public static final String CHANNEL_PLAY_RANDOM = "random";
public static final String CHANNEL_PLAY_REPEAT = "repeat";
public static final String CHANNEL_PLAY_URI = "play-uri";
public static final String CHANNEL_PLAY_FILE = "play-file";
public static final String CHANNEL_SYSTEM_COMMAND = "system-command";
public static final String CHANNEL_STOP = "stop-command";

// discovery properties
public static final String DISCOVERY_SERVICE_TYPE = "_Volumio._tcp.local.";
public static final String DISCOVERY_NAME_PROPERTY = "volumioName";
public static final String DISCOVERY_UUID_PROPERTY = "UUID";

// config
public static final String CONFIG_PROPERTY_HOSTNAME = "hostname";
public static final String CONFIG_PROPERTY_PORT = "port";
public static final String CONFIG_PROPERTY_PROTOCOL = "protocol";
public static final String CONFIG_PROPERTY_TIMEOUT = "timeout";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**
* Copyright (c) 2010-2023 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.volumio.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;

/**
* The {@link VolumioConfiguration} class contains fields mapping thing configuration parameters.
*
* @author Patrick Sernetz - Initial contribution
* @author Chris Wohlbrecht - Adapt for openHAB 3
* @author Michael Loercher - Adaption for openHAB 3
*/
@NonNullByDefault
public class VolumioConfiguration {

private String hostName = "";

private int port;

private String protocol = "";

private int timeout;

public String getHost() {
return hostName;
}

public void setHost(String host) {
this.hostName = host;
}

public int getPort() {
return port;
}

public void setPort(int port) {
this.port = port;
}

public String getProtocol() {
return protocol;
}

public void setProtocol(String protocol) {
this.protocol = protocol;
}

public int getTimeout() {
return timeout;
}

public void setTimeout(int timeout) {
this.timeout = timeout;
}
}
Loading