0.0.7 • Published 5 years ago

homebridge-automation-chromecast-play v0.0.7

Weekly downloads
5
License
ISC
Repository
github
Last release
5 years ago

Automation - Chromecast Play

Intro

This accessory will play/cast audio and/or video to your Chromecast on demand. It can be used for automation.

The list of media (audio/video) to be played must be stored on a file. The plugin will pick a random media from the file every time you turn on the switch. If you want to apply always the same, create a json file with only one media.

Media file

Example:

[
  {
    "name": "Ukulele Song",
    "url": "https://freepd.com/music/Ukulele%20Song.mp3",
    "author": {
      "name": "Rafael Krux"
    }
  },
  {
    "name": "Pond",
    "url": "https://freepd.com/music/Pond.mp3",
    "author": {
      "name": "Rafael Krux"
    },
    "mimeType": "audio/mp3",
    "streamType": "BUFFERED"
  }
]

The JSON file must contain an array of objects. Each object will be a media.

Format of each media object:

AttributeRequiredDescriptionExample
nameYesThe name of the mediaUkulele Song
urlYesThe URL of the media to be streamedhttps://freepd.com/music/Ukulele%20Song.mp3
author.nameNo (default: unknown)The name of the author of the mediaRafael Krux
mimeTypeNo (default: autodetect based on file extension)The MIME type of the file. See Chromecast supported typesaudio/mp3
streamTypeNo (default: BUFFERED)The type of stream. For files, use BUFFERED, for live feeds use LIVEBUFFERED

You can find an example file in this repo under media.json. This file contains some public domain audio (but you can stream video too).

Config

Example config.json:

{
  "accessories": [
    {
      "accessory": "AutomationChromecastPlay",
      "name": "Living Room Play",
      "chromecastDeviceName": "Living Room",
      "mediaFile": "./media.json"
    }
  ]
}

This accessory will create a switch. Turning on the switch will stream the media to your Chromecast. The switch will turn off automatically after 1 second.

The switch has the following properties:

NameDescriptionExample
AuthorThe name of the author of the current mediaRafael Krux
MediaThe name of the current applied mediaUkulele Song
StatusThe current media statusPlaying

Note: some properties are not compatible with iOS Home app, use Elgato Eve app instead.

Configuration options

AttributeRequiredUsageExample
nameYesA unique name for the accessory. It will be used as the accessory name in HomeKit.Living Room Play
chromecastDeviceNameYesThe name of your Chromecast device as shown in your Google Home App (case insensitive). This plugin will use Bonjour/mdns to detect the IP address of the Chromecast based on this name.Living Room
mediaFileYesThe path of the media file (relative to the Homebridge current working directory)./media.json

Other useful plugins

Do you want to automatically turn on the speakers when you stream some audio? Or adjust the volume of the speakers?

Check my homebridge-automation-chromecast plugin.

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago