Google music in HA

Hi

@Danielhiversen Do you plan including it as an official component? The initial setup didn’t work for several days so I started looking using ipython to look for clues, however that stuff is in Chinese :slight_smile: before realizing the custom component has been modified :smile:

Or, is it any way of getting a notification in HA when the custom component in git?

@JKW I commented 149 and changed 150 and 197 to " self.schedule_update_ha_state()" and now it works

What if I want to stream standard google play music stations? Like Christmas today’s song for exemple? Would it work?

I don’t have playlist I use…

Has anyone managed to get this to work in HassIO?

I’m about (or actually I DID pull my hair :))

I’m no good at python at all, but I did follow most of the steps, I installed gmusicapi inside the virtual env.

I am also NO good at configuring HA at all, I’m running raspian, not hassio (god why all this confusion!!)

I install ipython though sudo apt-get install ipython (and to confuse me more there is ipython3 too, which i installed)

your gmusic.py is executable, what do i do with it?

I’m also using iPhone, no android, how to get the android ID?

When running hass it says:

Blockquote

ERROR (Thread-2) [homeassistant.util.yaml] Secret [email protected] not defined

my configurations.yaml looks like this:

Blockquote

customize: !include gmusic.yaml

My gmusic.yaml looks like this:

Blockquote

input_select:
music:
name: Musikk
options:
- " " # Should be empty
icon: mdi:music-note
media_player:
name: Media player
options: # entity_ids of your media players
- “media_player.chromecast”
icon: mdi:music-note

switch:

OPTIONAL

group:
google_music:
name: Google Music
entities:
- input_select.music
- input_select.media_player
- switch.google_music

Well, the error message is pretty clear what the problem is. You haven’t set a secret with your email address in it, you’ve just literally copied the line !secret [email protected] in to your config.

Once you have sorted that out, put a random string in the device_id and run homeassistant and you’ll get another error message saying that the device id is incorrect, but listing your available ones, just copy one of them over and restart homeassistant again.

Ok I put the correct values and was able from ipython to get the device ID: 0x72c532b0

So I put those back but now i get this when starting hass:

Blockquote

ERROR (MainThread) [homeassistant.config] Invalid config for [homeassistant]: [input_select] is an invalid option for [homeassistant]. Check: homeassistant->customize->input_select. (See /home/pi/.homeassistant/configuration.yaml, line 2).

You have an input_select indented under a homeassistant tag. Move it back to the left 2 spaces.

Umm, the input_select is already first thing in line, however, I moved all gmusic.yaml to configurations.yaml as follows:

Blockquote
input_select:
music:
name: Thumbs up
options:
- " " # Should be empty
icon: mdi:music-note
media_player:
name: Media player
options: # entity_ids of your media players
- “media_player.chromecast”
icon: mdi:music-note

switch:

Now I get the following error:

Failed config
General Errors:
- Platform not found: switch.gmusic

I really don’t get it how to paste the code properly!!! Apologies for that

You’ve put the custom_component in?

i’m really sorry mf, and really thank you for your help, but i dont know what you mean :frowning:

i’ve put the gmusic.py file in:

/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components

Also, my configurations.yaml is located in /home/pi/.homeassistant

So i created a folder named custom_components in there too and copied the file gmusic.py

but still same error

The file needs to go in .homeassistant/custom_components/switch/

:+1:

Ok, we’re getting somewhere :slight_smile:

I also had to change the required version to 11.0.0

Umm, now it gives me this error:

ERROR (Thread-3) [custom_components.switch.gmusic] input_select.Thumbs up is not a valid input_select entity.

Thumbs up is the name of my playlist…what is wrong now?

I suspect your yaml formatting is out of whack, can you post it in a code block?

Put three backticks (a backtick is `), then a new line, then your code, then a new line and three backticks.

This is in my configurations.yaml

I also changed this media_player to media_player.chromecast (not sure if thats right or wrong)

input_select:
  music:
    name: Thumbs up
    options:
     - " "   # Should be empty
    icon: mdi:music-note
  media_player:
    name: Media player
    options: # entity_ids of your media players
     - "media_player.chromecast"
    icon: mdi:music-note


switch:
 - platform: gmusic
   user: [email protected]
   password: pass
   device_id: ios0CD34363-3EB1-42AC-902C-0999F5439E75 # http://unofficial-google-music-api.readthedocs.io/en/latest/reference/mobileclient.html#gmusicapi.clients.Mobileclient.l$
   media_player: media_player.chromecast # entity id of the input select used for mediaplayer
   playlist: Thumbs up # entity id of the input select used for playlist

GOD, THANK YOU FOR LETTING ME KNOW HOW TO PASTE THE FRIGGIN CODE!!! LOL!

Last two lines should be

media_player: media_player
playlist: music

(Its asking for the entity ids you defined above)

we are progressing my friend…

ERROR (Thread-11) [custom_components.switch.gmusic] input_select.media_player.chromecast is not a valid input_select entity.

I also tried only media_player only … same error

You still have media_player.chromecast on the penultimate line, change it to media_player as I suggested.

You need to save the file and restart homeassistant.

Yes yes, I already did change it before that to media_player only, still won’t work

ERROR (Thread-3) [custom_components.switch.gmusic] media_player is not a valid media player.

Please use this code…

input_select:
  music:
    name: Thumbs up
    options:
     - " "   # Should be empty
    icon: mdi:music-note
  media_player:
    name: Media player
    options: # entity_ids of your media players
     - "media_player.chromecast"
    icon: mdi:music-note


switch:
 - platform: gmusic
   user: [email protected]
   password: pass
   device_id: ios0CD34363-3EB1-42AC-902C-0999F5439E75
   media_player: media_player
   playlist: music

And put the correct email and password in, and confirm you have a media player called media_player.chromecast ?