Chromecast and Pandora

I couldn’t find any instructions for the above so after a few tries I’ve gotten it to work. The goal is to play Pandora in my daughter room using Chromecast at certain time at night.

Needless to say I don’t think this is the best solution but it works for my purpose so here goes in case anyone needs it.

1.Get mkchomecast which uses pychromecast
2. Using shell command to : remove any existing mkchromecast, launch mkchromecast to cast to my daughter room, set default output for pulseaudio to mkchromecast then launch pianobar.

Here are the command lines I’ve used.

shell_command:
  clear_existing_cast: 'rm -f /tmp/mkchromecast.pid'
  launch_cast: '/usr/bin/python /home/homeassistant/mkchromecast/mkchromecast.py --encoder-backend ffmpeg -n "Britney Bedroom"'
  set_default_output: '/usr/bin/pacmd "set-default-sink mkchromecast"'
  launch_pianobar: '/usr/local/bin/pianobar'

Lastly, create another script to kill mkchromecast and pianobar after the preset time.

2 Likes

Could you share your config? How did you pick a station once you launched pianobar?

Im away. You need to create stationID in the config file. To get the StationID, launch pianobar at command prompt/terminal, change to the desired station by keying the shortcut/key then note the stationID.