[chromecast] Improve documentation (#14136)

Signed-off-by: lsiepel <leosiepel@gmail.com>
This commit is contained in:
lsiepel 2023-01-02 19:53:42 +01:00 committed by GitHub
parent c7275c8946
commit 12bd7c99c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,8 +3,8 @@
The binding integrates Google Chromecast streaming devices. 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. It not only acts as a typical binding, but also registers each Chromecast device as an audio sink that can be used for playback.
When a Chromecast is used as an audio sink, the Chromecast connects to the runtime to get the audio streams. When a Chromecast is used as an audio sink, the Chromecast connects to openHAB to get the audio streams.
The binding sends the Chromecast URLs for getting the audio streams based on the Primary Address (Network Settings configuration) and the runtime HTTP port. The binding sends the Chromecast URLs for getting the audio streams based on the Primary Address (Network Settings configuration) and openHAB HTTP port.
These URL defaults can be overridden with the Callback URL configuration parameter. These URL defaults can be overridden with the Callback URL configuration parameter.
This can be configured on the binding level: This can be configured on the binding level:
@ -39,53 +39,52 @@ discovery.chromecast:background=false
## Thing Configuration ## Thing Configuration
Chromecast devices can also be manually added. Auto-discovery is enabled by default, but if needed Chromecast devices can also be manually added.
The only configuration parameter is the `ipAddress`. In case of manually adding a device the configuration parameter `ipAddress` has to be set.
For an audio group also the port is necessary. For an audio group also the port is necessary, that is available under advanced configuration.
The auto-discovery process finds the port automatically. With manual thing configuration the parameter `port` for audio group must be determined manually.
With manual thing configuration the parameter `port` must be determined manually.
Example for audio group: | Property | Default | Required | Advanced | Type | Description |
|-------------|---------|----------|----------|---------|------------------------------------------------------|
```java | ipAddress | - | Yes | No | String | The hostname or IP address of the Chromecast device. |
Thing chromecast:audiogroup:bathroom [ ipAddress="192.168.0.23", port=42139] | port | 8009 | No | Yes | Integer | The port where the Chromecast is listening |
``` | refreshRate | 10 | No | Yes | Integer | The refresh (poll) interval in seconds. |
## Channels ## Channels
| Channel Type ID | Item Type | Description | | Channel Type ID | Item Type | R/W | Description |
|-----------------|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |-----------------|-------------|-----|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| control | Player | Player control; currently only supports play/pause/next and does not correctly update, if the state changes on the device itself | | control | Player | R/W | Player control; currently only supports play/pause/next and does not correctly update, if the state changes on the device itself |
| stop | Switch | Send `ON` to this channel: Stops the Chromecast. If this channel is `ON`, the Chromecast is stopped, otherwise it is in another state (see control channel) | | stop | Switch | R/W | Send `ON` to this channel: Stops the Chromecast. If this channel is `ON`, the Chromecast is stopped, otherwise it is in another state (see control channel) |
| volume | Dimmer | Control the volume, this is also updated if the volume is changed by another app | | volume | Dimmer | R/W | Control the volume, this is also updated if the volume is changed by another app |
| mute | Switch | Mute the audio | | mute | Switch | R/W | Mute the audio |
| playuri | String | Can be used to tell the Chromecast to play media from a given url | | playuri | String | R/W | Can be used to tell the Chromecast to play media from a given url |
| appName | String | Name of currently running application | | appName | String | R | Name of currently running application |
| appId | String | ID of currently running application | | appId | String | R | ID of currently running application |
| idling | Switch | Read-only indication on whether Chromecast is on idle screen | | idling | Switch | R | Indication on whether Chromecast is on idle screen |
| statustext | String | | | statustext | String | R | |
| currentTime | Number:Time | Current time of currently playing media | | currentTime | Number:Time | R | Current time of currently playing media |
| duration | Number:Time | Duration of current track (null if between tracks) | | duration | Number:Time | R | Duration of current track (null if between tracks) |
| metadataType | String | Type of metadata, this indicates what metadata may be available. One of: GenericMediaMetadata, MovieMediaMetadata, TvShowMediaMetadata, MusicTrackMediaMetadata, PhotoMediaMetadata. | | metadataType | String | R | Type of metadata, this indicates what metadata may be available. One of: GenericMediaMetadata, MovieMediaMetadata, TvShowMediaMetadata, MusicTrackMediaMetadata, PhotoMediaMetadata. |
| subtitle | String | (GenericMediaMetadata) Descriptive subtitle of the content | | albumArtist | String | R | (MusicTrackMediaMetadata) Name of the artist associated with the album featuring this track |
| title | String | (GenericMediaMetadata) Descriptive title of the content | | albumName | String | R | (MusicTrackMediaMetadata) Album or collection from which this track is drawn |
| image | Image | (GenericMediaMetadata) Image for current media | | artist | String | R | (MusicTrackMediaMetadata) Name of the artist associated with the media track |
| imageSrc | String | (GenericMediaMetadata) URL of image for current media | | broadcastDate | DateTime | R | (TvShowMediaMetadata) ISO 8601 date and time this episode was released |
| releaseDate | DateTime | (GenericMediaMetadata) ISO 8601 date and time this content was released | | composer | String | R | (MusicTrackMediaMetadata) Name of the composer associated with the media track |
| albumArtist | String | (MusicTrackMediaMetadata) Name of the artist associated with the album featuring this track | | creationDate | DateTime | R | (PhotoMediaMetadata) ISO 8601 date and time this photograph was taken |
| albumName | String | (MusicTrackMediaMetadata) Album or collection from which this track is drawn | | discNumber | Number | R | (MusicTrackMediaMetadata) Number of the volume (for example, a disc) of the album |
| artist | String | (MusicTrackMediaMetadata) Name of the artist associated with the media track | | episodeNumber | Number | R | (TvShowMediaMetadata) Episode number (in the season) of the t.v. show |
| composer | String | (MusicTrackMediaMetadata) Name of the composer associated with the media track | | image | Image | R | (GenericMediaMetadata) Image for current media |
| discNumber | Number | (MusicTrackMediaMetadata) Number of the volume (for example, a disc) of the album | | imageSrc | String | R | (GenericMediaMetadata) URL of image for current media |
| trackNumber | Number | (MusicTrackMediaMetadata) Number of the track on the album | | locationName | String | R | (PhotoMediaMetadata) Verbal location where the photograph was taken; for example, "Madrid, Spain." |
| creationDate | DateTime | (PhotoMediaMetadata) ISO 8601 date and time this photograph was taken | | location | Location | R | (PhotoMediaMetadata) Geographical location of where the photograph was taken |
| locationName | String | (PhotoMediaMetadata) Verbal location where the photograph was taken; for example, "Madrid, Spain." | | releaseDate | DateTime | R | (GenericMediaMetadata) ISO 8601 date and time this content was released |
| location | Location | (PhotoMediaMetadata) Geographical location of where the photograph was taken | | seasonNumber | Number | R | (TvShowMediaMetadata) Season number of the t.v. show |
| broadcastDate | DateTime | (TvShowMediaMetadata) ISO 8601 date and time this episode was released | | seriesTitle | String | R | (TvShowMediaMetadata) Descriptive title of the t.v. series |
| episodeNumber | Number | (TvShowMediaMetadata) Episode number (in the season) of the t.v. show | | studio | String | R | (TvShowMediaMetadata) Studio which released the content |
| seasonNumber | Number | (TvShowMediaMetadata) Season number of the t.v. show | | subtitle | String | R | (GenericMediaMetadata) Descriptive subtitle of the content |
| seriesTitle | String | (TvShowMediaMetadata) Descriptive title of the t.v. series | | title | String | R | (GenericMediaMetadata) Descriptive title of the content |
| studio | String | (TvShowMediaMetadata) Studio which released the content | | trackNumber | Number | R | (MusicTrackMediaMetadata) Number of the track on the album |
## Full Example ## Full Example
@ -98,33 +97,35 @@ binding.chromecast:callbackUrl=http://192.168.30.58:8080
demo.things: demo.things:
```java ```java
Thing chromecast:audio:myCC "Lounge Chromecast Audio" [ipAddress="192.168.xxx.xxx", port=xxxx] Thing chromecast:audio:lounge_chromecast "Lounge Chromecast Audio" [ipAddress="192.168.xxx.xxx", port=8009]
Thing chromecast:chromecast:KitchenHomeHub "Kitchen Home Hub" [ipAddress="192.168.xxx.xxx", port=8009] Thing chromecast:chromecast:kitchen_chromecast "Kitchen Home Hub" [ipAddress="192.168.xxx.xxx", port=8009]
Thing chromecast:audiogroup:bathroom [ ipAddress="192.168..xxx.xxx", port=42139]
``` ```
demo.items: demo.items:
```java ```java
Dimmer Volume { channel="chromecast:audio:myCC:volume" } Dimmer kitchen_chromecast_volume { channel="chromecast:audio:kitchen_chromecast:volume" }
Player Music { channel="chromecast:audio:myCC:control" } Player kitchen_chromecast_control { channel="chromecast:audio:kitchen_chromecast:control" }
String kitchen_chromecast_appName { channel="chromecast:audio:kitchen_chromecast:appName" }
String kitchen_chromecast_artist { channel="chromecast:audio:kitchen_chromecast:artist" }
String kitchen_chromecast_albumName { channel="chromecast:audio:kitchen_chromecast:albumName" }
String kitchen_chromecast_title { channel="chromecast:audio:kitchen_chromecast:title" }
String kitchen_chromecast_image { channel="chromecast:audio:kitchen_chromecast:image" }
``` ```
demo.rules: demo.rules:
```javascript ```java
rule "Turn on kitchen speakers when Chromecast starts playing music" rule "Turn on kitchen speakers when Chromecast starts playing music"
when when
Item chromecast_chromecast_38e621581281c7675a777e7b474811ed_appId changed Item kitchen_chromecast_appid changed
then then
logInfo("RULE.AUDIO", "Chromecast id changed!") logInfo("RULE.AUDIO", "Chromecast app id changed!")
// 36061251 Pandora if (kitchen_chromecast_appid.kitchen_chromecast_appName.state == "Pandora" || kitchen_chromecast_appName.state == "Google Play Music") {
// 2872939A Google Play Music kitchen_speakersystem_power.sendCommand(ON)
if (chromecast_chromecast_38e621581281c7675a777e7b474811ed_appId.state == "36061251"
|| chromecast_chromecast_38e621581281c7675a777e7b474811ed_appId.state == "2872939A") {
kitchen_audio_power.sendCommand(ON)
kitchen_audio_source.sendCommand(1)
} }
end end
``` ```
@ -136,17 +137,18 @@ sitemap demo label="Main Menu" {
Frame { Frame {
Default item=Music Default item=Music
Slider item=Volume icon=soundvolume Slider item=Volume icon=soundvolume
Text item=kitchen_chromecast_appName
} }
} }
``` ```
```perl ```perl
sitemap chromecast label="Chromecasts" { sitemap chromecast label="Chromecasts" {
Frame label="Family Room: What's Playing" { Frame label="Kitchen: What's Playing" {
Image item=chromecast_chromecast_38e621581281c7675a777e7b474811ed_image Image item=kitchen_chromecast_image
Text item=chromecast_chromecast_38e621581281c7675a777e7b474811ed_artist label="Artist [%s]" Text item=kitchen_chromecast_artist label="Artist [%s]"
Text item=chromecast_chromecast_38e621581281c7675a777e7b474811ed_title label="Title [%s]" Text item=kitchen_chromecast_title label="Title [%s]"
Text item=chromecast_chromecast_38e621581281c7675a777e7b474811ed_albumName label="Album [%s]" Text item=kitchen_chromecast_albumName label="Album [%s]"
} }
} }
``` ```
@ -161,7 +163,13 @@ This binding includes rule actions for casting media.
Examples: Examples:
```java ```java
val castActions = getActions("chromecast","chromecast:chromecast:29fcf535da") val castActions = getActions("chromecast","chromecast:chromecast:kitchen_chromecast")
val success = castActions.playURL("http://192.168.1.160:81/mjpg/front1/video.mjpg")
val success2 = castActions.playURL("http://192.168.1.160:81/mjpg/front1/video.mjpg", "image/jpeg") rule "Show picture on Kitchen Chromecast on button press"
when
Item button_item changed from Off to On
then
val success2 = castActions.playURL("http://192.168.1.160:81/mjpg/front1/video.mjpg", "image/jpeg")
end
``` ```