forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Chromecast binding (openhab#1371)
Signed-off-by: Kai Kreuzer <[email protected]>
- Loading branch information
1 parent
53e97c9
commit 00bac1a
Showing
20 changed files
with
938 additions
and
0 deletions.
There are no files selected for viewing
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,9 @@ | ||
<?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 kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
<classpathentry kind="src" path="src/main/java"/> | ||
<classpathentry kind="lib" path="lib/shk-library-chromecast-api-1.11-SNAPSHOT.jar"/> | ||
<classpathentry kind="lib" path="lib/protobuf-java-2.6.0.jar"/> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</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,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.openhab.binding.chromecast</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
addons/binding/org.openhab.binding.chromecast/.settings/org.eclipse.jdt.core.prefs
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 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.8 |
19 changes: 19 additions & 0 deletions
19
addons/binding/org.openhab.binding.chromecast/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,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<binding:binding id="chromecast" | ||
xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:binding="http:https://eclipse.org/smarthome/schemas/binding/v1.0.0" | ||
xsi:schemaLocation="http:https://eclipse.org/smarthome/schemas/binding/v1.0.0 http:https://eclipse.org/smarthome/schemas/binding-1.0.0.xsd"> | ||
|
||
<name>Chromecast Binding</name> | ||
<description>This is the binding for Google Chromecast devices.</description> | ||
<author>Kai Kreuzer</author> | ||
|
||
<config-description> | ||
<parameter name="callbackUrl" type="text"> | ||
<label>Callback URL</label> | ||
<description>url to use for playing notification sounds, e.g. http:https://192.168.0.2:8080</description> | ||
<required>false</required> | ||
</parameter> | ||
</config-description> | ||
|
||
</binding:binding> |
68 changes: 68 additions & 0 deletions
68
addons/binding/org.openhab.binding.chromecast/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,68 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<thing:thing-descriptions bindingId="chromecast" | ||
xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:thing="http:https://eclipse.org/smarthome/schemas/thing-description/v1.0.0" | ||
xsi:schemaLocation="http:https://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http:https://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd"> | ||
|
||
<!-- Chromecast Audio Thing Type --> | ||
<thing-type id="audio"> | ||
<label>Chromecast Audio</label> | ||
<description>A Google Chromecast Audio device</description> | ||
|
||
<channels> | ||
<channel id="control" typeId="control"/> | ||
<channel id="volume" typeId="volume"/> | ||
<channel id="playuri" typeId="playuri"/> | ||
</channels> | ||
|
||
<config-description> | ||
<parameter name="ipAddress" type="text"> | ||
<context>network-address</context> | ||
<label>Network Address</label> | ||
<description>Network address of the Chromecast device.</description> | ||
<required>true</required> | ||
</parameter> | ||
</config-description> | ||
</thing-type> | ||
|
||
<!-- Chromecast HDMI dongle Thing Type --> | ||
<thing-type id="chromecast"> | ||
<label>Chromecast</label> | ||
<description>A Google Chromecast streaming device</description> | ||
|
||
<channels> | ||
<channel id="control" typeId="control"/> | ||
<channel id="volume" typeId="volume"/> | ||
<channel id="playuri" typeId="playuri"/> | ||
</channels> | ||
|
||
<config-description> | ||
<parameter name="ipAddress" type="text"> | ||
<context>network-address</context> | ||
<label>Network Address</label> | ||
<description>Network address of the Chromecast device.</description> | ||
<required>true</required> | ||
</parameter> | ||
</config-description> | ||
</thing-type> | ||
|
||
<channel-type id="volume"> | ||
<item-type>Dimmer</item-type> | ||
<label>Volume</label> | ||
<description>the sound volume of the device</description> | ||
<category>SoundVolume</category> | ||
</channel-type> | ||
|
||
<channel-type id="playuri" advanced="true"> | ||
<item-type>String</item-type> | ||
<label>Play URI</label> | ||
<description>Plays a given URI</description> | ||
</channel-type> | ||
|
||
<channel-type id="control"> | ||
<item-type>Player</item-type> | ||
<label>Control</label> | ||
<description>Player control</description> | ||
</channel-type> | ||
|
||
</thing:thing-descriptions> |
39 changes: 39 additions & 0 deletions
39
addons/binding/org.openhab.binding.chromecast/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,39 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: Chromecast Binding | ||
Bundle-SymbolicName: org.openhab.binding.chromecast;singleton:=true | ||
Bundle-Vendor: openHAB | ||
Bundle-Version: 2.0.0.qualifier | ||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | ||
Bundle-ClassPath: ., | ||
lib/protobuf-java-2.6.0.jar, | ||
lib/shk-library-chromecast-api-1.11-SNAPSHOT.jar | ||
Import-Package: | ||
com.fasterxml.jackson.annotation, | ||
javax.jmdns, | ||
org.apache.commons.lang, | ||
org.codehaus.jackson, | ||
org.codehaus.jackson.annotate, | ||
org.codehaus.jackson.map, | ||
org.codehaus.jackson.map.annotate, | ||
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.net, | ||
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.chromecast, | ||
org.openhab.binding.chromecast.handler, | ||
org.osgi.framework, | ||
org.osgi.service.component, | ||
org.slf4j | ||
Service-Component: OSGI-INF/*.xml | ||
Export-Package: org.openhab.binding.chromecast, | ||
org.openhab.binding.chromecast.handler | ||
Bundle-ActivationPolicy: lazy |
7 changes: 7 additions & 0 deletions
7
addons/binding/org.openhab.binding.chromecast/OSGI-INF/ChromecastDiscoveryParticipant.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,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<scr:component xmlns:scr="http:https://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.openhab.binding.chromecast"> | ||
<implementation class="org.openhab.binding.chromecast.internal.ChromecastDiscoveryParticipant"/> | ||
<service> | ||
<provide interface="org.eclipse.smarthome.config.discovery.UpnpDiscoveryParticipant"/> | ||
</service> | ||
</scr:component> |
20 changes: 20 additions & 0 deletions
20
addons/binding/org.openhab.binding.chromecast/OSGI-INF/ChromecastHandlerFactory.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,20 @@ | ||
<?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:https://www.eclipse.org/legal/epl-v10.html | ||
--> | ||
<scr:component xmlns:scr="http:https://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="binding.chromecast"> | ||
|
||
<implementation class="org.openhab.binding.chromecast.internal.ChromecastHandlerFactory"/> | ||
|
||
<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> |
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,66 @@ | ||
# Chromecast Binding | ||
|
||
The binding integrates Google Chromecast streaming devices. | ||
|
||
It not only acts as a typical binding, but also registers each Chromecast device as an audio sink that can be used for playback. | ||
|
||
In order play audio streams that are served from the runtime, the binding needs to know the url to access. This can be configured on the binding level: | ||
|
||
| Configuration Parameter | Type | Description | | ||
|-------------|--------|-----------------------------| | ||
| callbackUrl | text | optional Callback URL - url to use for playing notification sounds, e.g. http:https://192.168.0.2:8080 | | ||
|
||
|
||
## Supported Things | ||
|
||
The binding currently supports the "classic" Chromecast that is an HDMI dongle as well as the Chromecast Audio, which only does audio streaming and offers a headphone jack. | ||
|
||
## Discovery | ||
|
||
Chromecast devices are discovered on the network using mDNS (Bonjour). | ||
No authentication is required for accessing the devices on the network. | ||
|
||
## Thing Configuration | ||
|
||
Chromecast devices can also be manually added. The only configuration parameter is the `ipAddress`. | ||
|
||
## Channels | ||
|
||
| Channel Type ID | Item Type | Description | | ||
|-------------|--------|-----------------------------| | ||
| control | Player | Player control; currently only supports play/pause and does not correctly update, if the state changes on the device itself | | ||
| volume | Dimmer | Control the volume, this is also updated if the volume is changed by another app | | ||
| playuri | String | Can be used to tell the Chromecast to play media from a given url | | ||
|
||
## Full Example | ||
|
||
services.cfg: | ||
|
||
``` | ||
binding.chromecast:callbackUrl=http:https://192.168.30.58:8080 | ||
``` | ||
|
||
demo.things: | ||
|
||
``` | ||
chromecast:audio:myCC [ ipAddress="192.168.xxx.xxx"] | ||
``` | ||
|
||
demo.items: | ||
|
||
``` | ||
Dimmer Volume { channel="chromecast:audio:myCC:volume" } | ||
Player Music { channel="chromecast:audio:myCC:control" } | ||
``` | ||
|
||
demo.sitemap: | ||
|
||
``` | ||
sitemap demo label="Main Menu" | ||
{ | ||
Frame { | ||
Default item=Music | ||
Slider item=Volume icon=soundvolume | ||
} | ||
} | ||
``` |
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,45 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||
"http:https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http:https://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>October 31, 2016</p> | ||
<h3>License</h3> | ||
|
||
<p>The openHAB community 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:https://www.eclipse.org/legal/epl-v10.html">http:https://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 openHAB community, 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:https://www.openhab.org/">openhab.org</a>.</p> | ||
|
||
|
||
<h3>Third Party Content</h3> | ||
<p>The Content includes items that have been sourced from third parties as set out below. If you | ||
did not receive this Content directly from the openHAB community, the following is provided | ||
for informational purposes only, and you should look to the Redistributor's license for | ||
terms and conditions of use.</p> | ||
<p><em> | ||
|
||
<strong>protobuf-java</strong> <br/> | ||
<pre>BSD license</pre> </br> | ||
Source: http:https://code.google.com/p/protobuf | ||
</p></p> | ||
|
||
<strong>shk-library-chromecast-api</strong> <br/> | ||
<pre>Apache 2.0 License</pre> </br> | ||
Source: https://github.com/maggu2810/shk/tree/master/bundles/shk-library-chromecast-api | ||
</p></p> | ||
</body> | ||
</html> |
7 changes: 7 additions & 0 deletions
7
addons/binding/org.openhab.binding.chromecast/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 @@ | ||
output.. = target/classes | ||
bin.includes = META-INF/,\ | ||
.,\ | ||
OSGI-INF/,\ | ||
ESH-INF/,\ | ||
lib/ | ||
source.. = src/main/java/ |
Binary file added
BIN
+582 KB
addons/binding/org.openhab.binding.chromecast/lib/protobuf-java-2.6.0.jar
Binary file not shown.
Binary file added
BIN
+117 KB
...s/binding/org.openhab.binding.chromecast/lib/shk-library-chromecast-api-1.11-SNAPSHOT.jar
Binary file not shown.
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:https://www.w3.org/2001/XMLSchema-instance" xmlns="http:https://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http:https://maven.apache.org/POM/4.0.0 http:https://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.chromecast</artifactId> | ||
<version>2.0.0-SNAPSHOT</version> | ||
|
||
<name>Chromecast Binding</name> | ||
<packaging>eclipse-plugin</packaging> | ||
|
||
</project> |
Oops, something went wrong.