This repository has been archived by the owner on May 7, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial version of FS internet radio binding.
This binding is based on openhab 1.x binding frontiersiliconradio and is migrated to the new ESH API, including device discovery. Bug: #429 Signed-off-by: Patrick Koenemann <patrick.koenemann@itemis.de> Also-by: Rainer Ostendorf <github@linlab.de>
- Loading branch information
Patrick Koenemann
committed
Dec 8, 2015
1 parent
8877f08
commit 48da1fe
Showing
18 changed files
with
1,552 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
extensions/binding/org.eclipse.smarthome.binding.fsinternetradio/.classpath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?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="output" path="target/classes"/> | ||
</classpath> |
33 changes: 33 additions & 0 deletions
33
extensions/binding/org.eclipse.smarthome.binding.fsinternetradio/.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.eclipse.smarthome.binding.fsinternetradio</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> |
11 changes: 11 additions & 0 deletions
11
extensions/binding/org.eclipse.smarthome.binding.fsinternetradio/ESH-INF/binding/binding.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<binding:binding id="fsinternetradio" | ||
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>FSInternetRadio Binding</name> | ||
<description>This is the binding for internet radios based on the Frontier Silicon chipset.</description> | ||
<author>Patrick Koenemann</author> | ||
|
||
</binding:binding> |
101 changes: 101 additions & 0 deletions
101
...sions/binding/org.eclipse.smarthome.binding.fsinternetradio/ESH-INF/thing/thing-types.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<thing:thing-descriptions bindingId="fsinternetradio" | ||
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"> | ||
|
||
<!-- Sample Thing Type --> | ||
<thing-type id="radio"> | ||
<label>Internet Radio</label> | ||
<description>An internet radio device based on the Frontier Silicon chipset.</description> | ||
|
||
<channels> | ||
<channel id="power" typeId="power"/> | ||
<channel id="mode" typeId="mode"/> | ||
<channel id="volume-absolute" typeId="volume-absolute"/> | ||
<channel id="volume-percent" typeId="volume-percent"/> | ||
<channel id="mute" typeId="mute"/> | ||
<channel id="play-info-name" typeId="play-info-name"/> | ||
<channel id="play-info-text" typeId="play-info-text"/> | ||
<channel id="preset" typeId="preset"/> | ||
</channels> | ||
|
||
<properties> | ||
<property name="vendor">Frontiersilicon</property> | ||
<property name="modelId"></property> | ||
</properties> | ||
|
||
<config-description> | ||
<parameter name="ip" type="text" required="true"> | ||
<context>network_address</context> | ||
<label>Network Address</label> | ||
<description>The IP address (name or numeric) of the internet radio.</description> | ||
</parameter> | ||
<parameter name="port" type="integer" required="true"> | ||
<label>Port</label> | ||
<description>The port of the internet radio (default: 80).</description> | ||
<default>80</default> | ||
</parameter> | ||
<parameter name="pin" type="text" required="true"> | ||
<label>Pin</label> | ||
<description>The PIN configured in the internet radio (default: 1234).</description> | ||
<default>1234</default> | ||
</parameter> | ||
<parameter name="refresh" type="integer"> | ||
<label>Refresh interval</label> | ||
<description>Specifies the refresh interval in seconds.</description> | ||
<default>60</default> | ||
</parameter> | ||
</config-description> | ||
</thing-type> | ||
|
||
<channel-type id="power"> | ||
<item-type>Switch</item-type> | ||
<label>Power</label> | ||
<description>Switch the radio on or off.</description> | ||
<category>Switch</category> | ||
</channel-type> | ||
<channel-type id="preset"> | ||
<item-type>Number</item-type> | ||
<label>Preset</label> | ||
<description>Preset radio stations configured in the radio.</description> | ||
</channel-type> | ||
<channel-type id="volume-absolute" advanced="true"> | ||
<item-type>Number</item-type> | ||
<label>Volume</label> | ||
<description>Volume (min=0, max=32).</description> | ||
<category>SoundVolume</category> | ||
<state min="0" max="32" step="1" /> | ||
</channel-type> | ||
<channel-type id="volume-percent"> | ||
<item-type>Dimmer</item-type> | ||
<label>Volume</label> | ||
<description>Volume (in percent).</description> | ||
<category>SoundVolume</category> | ||
<state min="0" max="100" step="3" /> <!-- 3% correspond to 1 absolute step --> | ||
</channel-type> | ||
<channel-type id="mute"> | ||
<item-type>Switch</item-type> | ||
<label>Mute</label> | ||
<description>Mute the radio.</description> | ||
</channel-type> | ||
<channel-type id="play-info-name"> | ||
<item-type>String</item-type> | ||
<label>Current Title</label> | ||
<description>The name of the current radio station or track.</description> | ||
<state readOnly="true" /> | ||
</channel-type> | ||
<channel-type id="play-info-text"> | ||
<item-type>String</item-type> | ||
<label>Info Text</label> | ||
<description>Additional information e.g. of the current radio station.</description> | ||
<state readOnly="true" /> | ||
</channel-type> | ||
<channel-type id="mode"> | ||
<item-type>Number</item-type> | ||
<label>Mode</label> | ||
<description>The radio mode, e.g. FM radio, internet radio, AUX, etc.</description> | ||
<state min="0" step="1" /> | ||
</channel-type> | ||
|
||
</thing:thing-descriptions> |
26 changes: 26 additions & 0 deletions
26
extensions/binding/org.eclipse.smarthome.binding.fsinternetradio/META-INF/MANIFEST.MF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: FSInternetRadio Binding | ||
Bundle-SymbolicName: org.eclipse.smarthome.binding.fsinternetradio;singleton:=true | ||
Bundle-Vendor: Eclipse.org/SmartHome | ||
Bundle-Version: 0.8.0.qualifier | ||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7 | ||
Bundle-ClassPath: . | ||
Import-Package: | ||
org.apache.commons.httpclient, | ||
org.apache.commons.httpclient.methods, | ||
org.apache.commons.httpclient.params, | ||
org.apache.commons.io, | ||
org.eclipse.smarthome.config.core, | ||
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.eclipse.smarthome.config.discovery, | ||
org.jupnp.model.meta, | ||
org.slf4j | ||
Service-Component: OSGI-INF/*.xml | ||
Export-Package: org.eclipse.smarthome.binding.fsinternetradio, | ||
org.eclipse.smarthome.binding.fsinternetradio.handler |
16 changes: 16 additions & 0 deletions
16
...nding/org.eclipse.smarthome.binding.fsinternetradio/OSGI-INF/FSInternetRadioDiscovery.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2014-2015 openHAB UG (haftungsbeschraenkt) 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" immediate="true" name="org.eclipse.smarthome.binding.fsinternetradio.discovery.radio"> | ||
<implementation class="org.eclipse.smarthome.binding.fsinternetradio.internal.FSInternetRadioDiscoveryParticipant"/> | ||
<service> | ||
<provide interface="org.eclipse.smarthome.config.discovery.UpnpDiscoveryParticipant"/> | ||
</service> | ||
</scr:component> |
19 changes: 19 additions & 0 deletions
19
.../org.eclipse.smarthome.binding.fsinternetradio/OSGI-INF/FSInternetRadioHandlerFactory.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2014-2015 openHAB UG (haftungsbeschraenkt) 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" immediate="true" name="org.eclipse.smarthome.binding.fsinternetradio.internal.FSInternetRadioHandlerFactory"> | ||
|
||
<implementation class="org.eclipse.smarthome.binding.fsinternetradio.internal.FSInternetRadioHandlerFactory"/> | ||
|
||
<service> | ||
<provide interface="org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory"/> | ||
</service> | ||
|
||
</scr:component> |
95 changes: 95 additions & 0 deletions
95
extensions/binding/org.eclipse.smarthome.binding.fsinternetradio/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
--- | ||
layout: documentation | ||
--- | ||
|
||
{% include base.html %} | ||
|
||
# FS Internet Radio Binding | ||
|
||
This binding integrates internet radios based on the [Frontier Silicon chipset](http://www.frontier-silicon.com/). | ||
|
||
## Supported Things | ||
|
||
Successfully tested are internet radios [Hama IR100](https://de.hama.com/00054823/hama-internetradio-ir110), [Medion MD87180](http://internetradio.medion.com/), and [MEDION MD86988](http://internetradio.medion.com/). | ||
|
||
But in principle, all internet radios based on the [Frontier Silicon chipset](http://www.frontier-silicon.com/) should be supported because they share the same API. | ||
|
||
## Discovery | ||
|
||
The radios are discovered through UPnP in the local network. | ||
|
||
If your radio is not discovered, please try to access its API via: `http://<radio-ip>/fsapi/CREATE_SESSION?pin=1234` (1234 is default pin, if you get a 403 error, check the radio menu for the correct pin). | ||
If you get a result like `FS_OK 1902014387`, your radio is supported. | ||
|
||
If this is the case, please [add your model to this documentation](https://github.com/eclipse/smarthome/edit/master/extensions/binding/org.eclipse.smarthome.binding.fsinternetradio/README.md) and provide discovery information [in this thread](https://community.openhab.org/t/internet-radio-i-need-your-help/2131). | ||
|
||
## Binding Configuration | ||
|
||
The binding itself does not need a configuration. | ||
|
||
## Thing Configuration | ||
|
||
Each radio must be configured via its ip address, port, pin, and a refresh rate. | ||
* If the ip address is not discovered automatically, it must be manually set. | ||
* The default port is `80` which should work for most radios. | ||
* The default pin is `1234` for most radios, but if it does not work or if it was changed, look it up in the on-screen menu of the radio. | ||
* The default refresh rate for the radio items is `60` seconds; `0` disables periodic refresh. | ||
|
||
## Channels | ||
|
||
All devices support some of the following channels: | ||
|
||
| Channel Type ID | Item Type | Description | Access | | ||
|-----------------|-----------|-------------|------- | | ||
| power | Switch | Switch the radio on or off | R/W | | ||
| volume-percent | Dimmer | Radio volume (min=0, max=100) | R/W | | ||
| volume-absolute | Number | Radio volume (min=0, max=32) | R/W | | ||
| mute | Switch | Mute the radio | R/W | | ||
| mode | Number | The radio mode, e.g. FM radio, internet radio, AUX, etc. (model-specific, see list below) | R/W | | ||
| preset | Number | Preset radio stations configured in the radio (write-only) | W | | ||
| play-info-name | String | The name of the current radio station or track | R | | ||
| play-info-text | String | Additional information e.g. of the current radio station | R | | ||
|
||
The radio mode depends on the internet radio model (and probably its firmware version): | ||
|
||
| Radio mode | Hama IR110 | Medion MD87180 | Medion MD 86988 | | ||
|------------|------------|----------------|-----------------| | ||
| 0 | Internet Radio | Internet Radio | Internet Radio | | ||
| 1 | Spotify | Music Player (USB, LAN) | Music Player | | ||
| 2 | Player | DAB Radio | FM Radio | | ||
| 3 | AUX in | FM Radio | AUX in | | ||
| 4 | - | AUX in | - | | ||
|
||
## Full Example | ||
|
||
demo.things: | ||
``` | ||
fsinternetradio:radio:radioInKitchen [ ip="192.168.0.42" ] | ||
``` | ||
|
||
demo.items: | ||
``` | ||
Switch RadioPower "Radio Power" { channel="fsinternetradio:radio:radioInKitchen:power" } | ||
Switch RadioMute "Radio Mute" { channel="fsinternetradio:radio:radioInKitchen:mute" } | ||
Dimmer RadioVolume "Radio Volume" { channel="fsinternetradio:radio:radioInKitchen:volume-percent" } | ||
Number RadioMode "Radio Mode" { channel="fsinternetradio:radio:radioInKitchen:mode" } | ||
Number RadioPreset "Radio Stations" { channel="fsinternetradio:radio:radioInKitchen:preset" } | ||
String RadioInfo1 "Radio Info1" { channel="fsinternetradio:radio:radioInKitchen:play-info-name" } | ||
String RadioInfo2 "Radio Info2" { channel="fsinternetradio:radio:radioInKitchen:play-info-text" } | ||
``` | ||
|
||
demo.sitemap: | ||
``` | ||
sitemap demo label="Main Menu" | ||
{ | ||
Frame { | ||
Switch item=RadioPower | ||
Slider visibility=[RadioPower==ON] item=RadioVolume | ||
Switch visibility=[RadioPower==ON] item=RadioMute | ||
Selection visibility=[RadioPower==ON] item=RadioPreset mappings=[0="Favourit 1", 1="Favourit 2", 2="Favourit 3", 3="Favourit 4"] | ||
Selection visibility=[RadioPower==ON] item=RadioMode mappings=[0="Internet Radio", 1="Musik Player", 2="DAB", 3="FM", 4="AUX"] | ||
Text visibility=[RadioPower==ON] item=RadioInfo1 | ||
Text visibility=[RadioPower==ON] item=RadioInfo2 | ||
} | ||
} | ||
``` |
28 changes: 28 additions & 0 deletions
28
extensions/binding/org.eclipse.smarthome.binding.fsinternetradio/about.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> | ||
<title>About</title> | ||
</head> | ||
<body lang="EN-US"> | ||
<h2>About This Content</h2> | ||
|
||
<p>June 5, 2006</p> | ||
<h3>License</h3> | ||
|
||
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise | ||
indicated below, the Content is provided to you under the terms and conditions of the | ||
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available | ||
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. | ||
For purposes of the EPL, "Program" will mean the Content.</p> | ||
|
||
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is | ||
being redistributed by another party ("Redistributor") and different terms and conditions may | ||
apply to your use of any object code in the Content. Check the Redistributor's license that was | ||
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise | ||
indicated below, the terms and conditions of the EPL still apply to any source code in the Content | ||
and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> | ||
|
||
</body> | ||
</html> |
7 changes: 7 additions & 0 deletions
7
extensions/binding/org.eclipse.smarthome.binding.fsinternetradio/build.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
source.. = src/main/java/ | ||
output.. = target/classes | ||
bin.includes = META-INF/,\ | ||
.,\ | ||
OSGI-INF/,\ | ||
ESH-INF/,\ | ||
about.html |
19 changes: 19 additions & 0 deletions
19
extensions/binding/org.eclipse.smarthome.binding.fsinternetradio/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?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"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.eclipse.smarthome.binding</groupId> | ||
<artifactId>pom</artifactId> | ||
<version>0.8.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>org.eclipse.smarthome.binding</groupId> | ||
<artifactId>org.eclipse.smarthome.binding.fsinternetradio</artifactId> | ||
<version>0.8.0-SNAPSHOT</version> | ||
|
||
<name>FSInternetRadio Binding</name> | ||
<packaging>eclipse-plugin</packaging> | ||
|
||
</project> |
Oops, something went wrong.