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 ParameterTypeDescription
callbackUrltextoptional Callback URL - url to use for playing notification sounds, e.g. http://192.168.0.2:8080

Supported Things

ThingsDescriptionThing Type
ChromecastClassic HDMI video Chromecasts and Google Homeschromecast
Chromecast AudioThe Chromecast whichonly does audio streaming and offers a headphone jackaudio
Audio GroupA Chromecast audio group for multi-room audio defined via the Chromecast appaudiogroup

Discovery

Chromecast devices are discovered on the network using UPnP. 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 IDItem TypeDescription
controlPlayerPlayer control; currently only supports play/pause and does not correctly update, if the state changes on the device itself
volumeDimmerControl the volume, this is also updated if the volume is changed by another app
muteSwitchMute the audio
playuriStringCan be used to tell the Chromecast to play media from a given url
appNameStringName of currently running application
appIdStringID of currently running application
idlingSwitchRead-only indication on weather Chromecast is on idle screen
statustextString
currentTimeNumber
durationNumberDuration of current track (null if between tracks)
metadataTypeStringType of metadata, this indicates what metadata may be available. One of: GenericMediaMetadata, MovieMediaMetadata, TvShowMediaMetadata, MusicTrackMediaMetadata, PhotoMediaMetadata.
subtitleString(GenericMediaMetadata) Descriptive subtitle of the content
titleString(GenericMediaMetadata) Descriptive title of the content
imageImage(GenericMediaMetadata) Image for current media
imageSrcString(GenericMediaMetadata) URL of image for current media
releaseDateDateTime(GenericMediaMetadata) ISO 8601 date and time this content was released
albumArtistString(MusicTrackMediaMetadata) Name of the artist associated with the album featuring this track
albumNameString(MusicTrackMediaMetadata) Album or collection from which this track is drawn
artistString(MusicTrackMediaMetadata) Name of the artist associated with the media track
composerString(MusicTrackMediaMetadata) Name of the composer associated with the media track
discNumberNumber(MusicTrackMediaMetadata) Number of the volume (for example, a disc) of the album
trackNumberNumber(MusicTrackMediaMetadata) Number of the track on the album
creationDateDateTime(PhotoMediaMetadata) ISO 8601 date and time this photograph was taken
locationNameString(PhotoMediaMetadata) Verbal location where the photograph was taken; for example, "Madrid, Spain."
locationPoint(PhotoMediaMetadata) Geographical location of where the photograph was taken
broadcastDateDateTime(TvShowMediaMetadata) ISO 8601 date and time this episode was released
episodeNumberNumber(TvShowMediaMetadata) Episode number (in the season) of the t.v. show
seasonNumberNumber(TvShowMediaMetadata) Season number of the t.v. show
seriesTitleString(TvShowMediaMetadata) Descriptive title of the t.v. series
studioString(TvShowMediaMetadata) Studio which released the content

Full Example

services.cfg:

binding.chromecast:callbackUrl=http://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.rules:

rule "Turn on kitchen speakers when Chromecast starts playing music"
when
    Item chromecast_chromecast_38e621581281c7675a777e7b474811ed_appId changed
then
    logInfo("RULE.AUDIO", "Chromecast id changed!")

    // 36061251 Pandora
    // 2872939A Google Play Music

    if (chromecast_chromecast_38e621581281c7675a777e7b474811ed_appId.state == "36061251"
    || chromecast_chromecast_38e621581281c7675a777e7b474811ed_appId.state == "2872939A") {
        kitchen_audio_power.sendCommand(ON)
        kitchen_audio_source.sendCommand(1)
    }
end

demo.sitemap:

sitemap demo label="Main Menu" {
    Frame {
        Default item=Music
        Slider item=Volume icon=soundvolume
    }
}
sitemap chromecast label="Chromecasts" {
    Frame label="Family Room: What's Playing" {
        Image item=chromecast_chromecast_38e621581281c7675a777e7b474811ed_image
        Text item=chromecast_chromecast_38e621581281c7675a777e7b474811ed_artist label="Artist [%s]"
        Text item=chromecast_chromecast_38e621581281c7675a777e7b474811ed_title label="Title [%s]"
        Text item=chromecast_chromecast_38e621581281c7675a777e7b474811ed_albumName label="Album [%s]"
    }
}