-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Initial commit of the kodi binding #1262
Changes from 12 commits
b46ec8c
bc68921
b995fbf
fdc200d
72cb474
83ad75e
ef5bbd0
7fa15f0
68eacc1
91fc7f7
ecb651a
59f1640
a8dfa6f
1ada508
7fed57e
f6aa55c
37154e1
530e742
a6f3e1b
ef14153
1824c28
7cb54c0
14cebf0
bbecdab
49ba238
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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> |
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.binding.kodi</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> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<binding:binding id="kodi" | ||
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>Kodi Binding</name> | ||
<description>This is the binding for Kodi.</description> | ||
<author>Paul Frank</author> | ||
|
||
<config-description> | ||
<parameter name="callbackUrl" type="text"> | ||
<label>Callback URL</label> | ||
<description>url to use for playing notification sounds, e.g. http://192.168.0.2:8080</description> | ||
<required>false</required> | ||
</parameter> | ||
</config-description> | ||
</binding:binding> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# binding | ||
binding.kodi.name = Kodi Binding | ||
binding.kodi.description = Das Kodi Binding erlaubt das Kodi Media Center zu steuern | ||
|
||
# thing types | ||
thing-type.kodi.kodi.label = Kodi Media Center | ||
thing-type.kodi.kodi.description = Kodi Media Center Binding | ||
thing-type.config.kodi.kodi.ipAddress.label = Netzwerkaddresse | ||
thing-type.config.kodi.kodi.ipAddress.description = IP Addresse oder Host Name des Kodi Media Centers | ||
thing-type.config.kodi.kodi.port.label = Port | ||
thing-type.config.kodi.kodi.port.description = Port des Web Socket Services des Kodi Media Centers | ||
|
||
# channel types | ||
channel-type.kodi.volume.label = Lautst�rke | ||
channel-type.kodi.volume.description = Lautst�rke des Kodi Media Centers | ||
channel-type.kodi.mute.label = Stumm schalten | ||
channel-type.kodi.mute.description = Das Kodi Media Centers stumm schalten | ||
channel-type.kodi.control.label = Kontrolle | ||
channel-type.kodi.control.description = Steuert das Kodi Media Center (z.B. Play, Pause, Stop) | ||
channel-type.kodi.playuri.label = URI abspielen | ||
channel-type.kodi.playuri.description = Spielt einen URI ab | ||
channel-type.kodi.shownotification.label = Nachricht anzeigen | ||
channel-type.kodi.shownotification.description = Zeigt eine Nachricht auf dem Bildschirm an | ||
channel-type.kodi.input.label = Tastendruck | ||
channel-type.kodi.input.description = Schickt einen Tastendruck an das Kodi Media Center um auf dem Bildschirm zu navigieren | ||
channel-type.kodi.inputtext.label = Texteingabe | ||
channel-type.kodi.inputtext.description = Schickt eine Zeichenkette als Eingabe an das Kodi Media Center | ||
channel-type.kodi.title.label = Titel | ||
channel-type.kodi.title.description = Titel des aktuellen St�cks oder Films | ||
channel-type.kodi.title.label = Titel | ||
channel-type.kodi.title.description = Titel des aktuellen St�cks oder Films | ||
channel-type.kodi.album.label = Album | ||
channel-type.kodi.album.description = Album des aktuellen St�cks | ||
channel-type.kodi.artist.label = K�nstler | ||
channel-type.kodi.artist.description = K�nstler des aktuellen St�cks oder Films | ||
channel-type.kodi.mediatype.label = Medientyp | ||
channel-type.kodi.mediatype.description = Medientyp des aktuellen St�cks oder Films (z. B. movie, song) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<thing:thing-descriptions bindingId="kodi" 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"> | ||
|
||
<!-- Kodi Thing Type --> | ||
<thing-type id="kodi"> | ||
<label>Kodi Mediacenter</label> | ||
<description>Kodi Mediacenter Binding</description> | ||
|
||
<channels> | ||
<channel id="volume" typeId="volume" /> | ||
<channel id="mute" typeId="mute" /> | ||
<channel id="control" typeId="control" /> | ||
<channel id="playuri" typeId="playuri" /> | ||
<channel id="shownotification" typeId="shownotification" /> | ||
<channel id="input" typeId="input" /> | ||
<channel id="inputtext" typeId="inputtext" /> | ||
<channel id="title" typeId="title" /> | ||
<channel id="album" typeId="album" /> | ||
<channel id="artist" typeId="artist" /> | ||
<channel id="mediatype" typeId="mediatype" /> | ||
</channels> | ||
|
||
<properties> | ||
<property name="version">unknown</property> | ||
</properties> | ||
|
||
<config-description> | ||
<parameter name="ipAddress" type="text" required="true"> | ||
<label>Network Address</label> | ||
<description>The IP or host name of the kodi</description> | ||
<context>network-address</context> | ||
</parameter> | ||
<parameter name="port" type="integer" required="true" min="1" max="65335"> | ||
<label>Web socket service port</label> | ||
<description>Port for the web socket service</description> | ||
<default>9090</default> | ||
</parameter> | ||
</config-description> | ||
</thing-type> | ||
|
||
<!-- Kodi Commands --> | ||
<channel-type id="mute"> | ||
<item-type>Switch</item-type> | ||
<label>Mute</label> | ||
<description>Mute/unmute your device</description> | ||
</channel-type> | ||
<channel-type id="volume"> | ||
<item-type>Dimmer</item-type> | ||
<label>Volume</label> | ||
<description>Volume of your device</description> | ||
<state min="0" max="100" step="1" pattern="%d %%"> | ||
</state> | ||
</channel-type> | ||
<channel-type id="control"> | ||
<item-type>Player</item-type> | ||
<label>Control</label> | ||
<description>Control the Kodi Player, e.g. start/stop/next/previous/ffward/rewind</description> | ||
<category>Player</category> | ||
</channel-type> | ||
<channel-type id="playuri" advanced="true"> | ||
<item-type>String</item-type> | ||
<label>Play URI</label> | ||
<description>Play the given URI</description> | ||
</channel-type> | ||
<channel-type id="shownotification" advanced="true"> | ||
<item-type>String</item-type> | ||
<label>Show Notification</label> | ||
<description>Shows a notification on the UI</description> | ||
</channel-type> | ||
<channel-type id="input" advanced="true"> | ||
<item-type>String</item-type> | ||
<label>Send a key</label> | ||
<description>Sends a key stroke to the Kodi Player to navigate in the UI</description> | ||
<state> | ||
<options> | ||
<option value="Left">Left</option> | ||
<option value="Right">Right</option> | ||
<option value="Up">Up</option> | ||
<option value="Down">Down</option> | ||
<option value="Select">Select</option> | ||
<option value="Back">Back</option> | ||
<option value="Home">Home</option> | ||
<option value="ContextMenu">Context Menu</option> | ||
<option value="Info">Info</option> | ||
<option value="ShowCodec">Show Codec</option> | ||
<option value="ShowOSD">Show OSD</option> | ||
</options> | ||
</state> | ||
</channel-type> | ||
<channel-type id="inputtext" advanced="true"> | ||
<item-type>String</item-type> | ||
<label>Sends text as input</label> | ||
<description>Sends a text to the Kodi Player to simulate keyboard text entry</description> | ||
</channel-type> | ||
|
||
|
||
<!-- Kodi variables --> | ||
<channel-type id="title"> | ||
<item-type>String</item-type> | ||
<label>Title</label> | ||
<description>Title of the current song</description> | ||
<state readOnly="true" pattern="%s"></state> | ||
</channel-type> | ||
<channel-type id="album"> | ||
<item-type>String</item-type> | ||
<label>Album</label> | ||
<description>Album name of the current song</description> | ||
<state readOnly="true" pattern="%s"></state> | ||
</channel-type> | ||
<channel-type id="artist"> | ||
<item-type>String</item-type> | ||
<label>Artist</label> | ||
<description>Artist name of the current song</description> | ||
<state readOnly="true" pattern="%s"></state> | ||
</channel-type> | ||
<channel-type id="mediatype"> | ||
<item-type>String</item-type> | ||
<label>Media Type</label> | ||
<description>Media type of the current file</description> | ||
<state readOnly="true" pattern="%s"></state> | ||
</channel-type> | ||
</thing:thing-descriptions> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: Kodi Binding | ||
Bundle-SymbolicName: org.openhab.binding.kodi;singleton:=true | ||
Bundle-Vendor: openHAB | ||
Bundle-Version: 2.0.0.qualifier | ||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7 | ||
Bundle-ClassPath: . | ||
Import-Package: | ||
com.google.common.base, | ||
com.google.common.collect, | ||
com.google.gson, | ||
org.apache.commons.lang, | ||
org.eclipse.jetty.util.component, | ||
org.eclipse.jetty.websocket.api, | ||
org.eclipse.jetty.websocket.api.annotations, | ||
org.eclipse.jetty.websocket.client, | ||
org.eclipse.jetty.websocket.common, | ||
org.eclipse.smarthome.config.core, | ||
org.eclipse.smarthome.config.discovery, | ||
org.eclipse.smarthome.core.audio, | ||
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.jupnp.model.meta, | ||
org.jupnp.model.types, | ||
org.openhab.binding.kodi, | ||
org.openhab.binding.kodi.handler, | ||
org.osgi.framework, | ||
org.osgi.service.component, | ||
org.slf4j | ||
Service-Component: OSGI-INF/*.xml | ||
Export-Package: org.openhab.binding.kodi, | ||
org.openhab.binding.kodi.handler | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?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.openhab.onkyo" activate="activate"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. org.openhab.onkyo -> org.openhab.kodi |
||
<implementation class="org.openhab.binding.kodi.internal.discovery.KodiDiscoveryParticipant"/> | ||
<service> | ||
<provide interface="org.eclipse.smarthome.config.discovery.UpnpDiscoveryParticipant"/> | ||
</service> | ||
</scr:component> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2014-2016 by the respective copyright holders. | ||
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" configuration-policy="optional" immediate="true" name="binding.kodi"> | ||
|
||
<implementation class="org.openhab.binding.kodi.internal.KodiHandlerFactory"/> | ||
|
||
<service> | ||
<provide interface="org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory"/> | ||
</service> | ||
<reference bind="setAudioHTTPServer" cardinality="1..1" interface="org.eclipse.smarthome.core.audio.AudioHTTPServer" name="AudioHTTPServer" policy="static" unbind="unsetAudioHTTPServer"/> | ||
</scr:component> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Kodi Binding | ||
|
||
This binding integrates the Kodi players (which used to be XBMC). | ||
|
||
## Introduction | ||
|
||
|
||
## Supported Things | ||
|
||
This binding supports only one thing: The Kodi player. All kodi devices are registered as an audio sink in the framework. | ||
|
||
|
||
## Discovery | ||
|
||
This binding can discover the Kodi players. | ||
|
||
## Binding Configuration | ||
|
||
The binding can auto-discover the Kodi players present on your local network. The auto-discovery is enabled by default. To disable it, you can create a file in the services directory called Kodi.cfg with the following content: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line should actually be in the "Discovery" section. And no need to create a Kodi.cfg file; instead, the line should be added to conf/services/runtime.cfg. |
||
|
||
``` | ||
org.openhab.Kodi:enableAutoDiscovery=false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. org.openhab.Kodi -> org.openhab.kodi |
||
``` | ||
|
||
This configuration parameter only controls the Kodi player auto-discovery process, not the openHAB auto-discovery. Moreover, if the openHAB auto-discovery is disabled, the Kodi player auto-discovery is disabled too. | ||
|
||
The binding has the following configuration option, which can be set for "binding:kodi": | ||
|
||
| Parameter | Name | Description | Required | | ||
|-----------------|------------------------|--------------|------------ | | ||
| callbackUrl | Callback URL | URL to use for playing notification sounds, e.g. http://192.168.0.2:8080 | no | | ||
|
||
|
||
## Thing Configuration | ||
|
||
The Kodi player thing requires the ip address and the port to access it on. | ||
In the thing file, this looks e.g. like | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add an empty line above code sections as otherwise Jekyll breaks the layout. |
||
Kodi:Kodi:myKodi [ipAddress="192.168.1.100", port="9090"] | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are missing the closing ``` here. |
||
|
||
##Channels | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
The Kodi thing supports the following channels: | ||
|
||
| Channel Type ID | Item Type | Description | | ||
|-------------------------|--------------|--------------| | ||
| mute | Switch | Mute/unmute your device | | ||
| volume | Dimmer | Volume of your device | | ||
| control | Player | Control the Kodi player, e.g. play/pause/next/previous/ffward/rewind | | ||
| title | String | Title of the current song| | ||
| album | String | Album name of the current song| | ||
| artist | String | Artist name of the current song| | ||
| playuri | String | Plays the file with the provided URI| | ||
| shownotification | String | Shows the provided notification message on the screen| | ||
| input | String | Allows to navigate on the screen. Valid values are: Up, Down, Left, Right, Select, Back, Home, ContextMenu, Info, ShowCodec, ShowOSD| | ||
| inputtext | String | This channel emulates the keyboard entry| | ||
| mediatype | String | The media type of the current file. e.g. song, movie| | ||
|
||
|
||
## Audio Support | ||
|
||
All supported kodi devices are registered as an audio sink in the framework. | ||
Audio streams are sent to the `playuri` channel. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
source.. = src/main/java/ | ||
output.. = target/classes | ||
bin.includes = META-INF/,\ | ||
.,\ | ||
OSGI-INF/,\ | ||
ESH-INF/ | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?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.openhab.binding</groupId> | ||
<artifactId>pom</artifactId> | ||
<version>2.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
|
||
<groupId>org.openhab.binding</groupId> | ||
<artifactId>org.openhab.binding.kodi</artifactId> | ||
<version>2.0.0-SNAPSHOT</version> | ||
|
||
<name>Kodi Binding</name> | ||
<packaging>eclipse-plugin</packaging> | ||
</project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have stored the file with text encoding ISO 8859-1. As a result the german "umlauts" do not appear correctly (in Chrome on Windows) neither in Paper UI nor in Basic UI. I have changed the encoding to UTF-8 and corrected the "umlauts". Then everything looked fine.
@kaikreuzer I have tried to find a hint on the correct encoding in the developer documentation for Smarthome and openHAB but without success . Java sources and XML files are all using UTF-8 but all properties files in the openHAB repository that I have checked were using encoding ISO 8859-1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the meantime I have created an issue in the Smarthome repository (eclipse-archived/smarthome#2639) because other bindings have the same problem.