Google Music in HA -- Now as a media player!

@troy I tried that, both commands, no luck :frowning:

@slipx06 Yup, here is my gmusic_config.yaml

media_player:
  - platform: gmusic_player
    username: < Username/email >
    password: < App Password, cause I have 2FactorAuth >
    device_id: 300b9038d4df4e61

input_select:
  gmusic_player_speakers:
    name: Speakers
    icon: mdi:speaker
    ## Add your media_players below
    options: # Example media_players
    - mediacenter

And this is my kodi config in configuration.yaml:

..
media_player:
  - platform: kodi
    name: mediacenter
    host: 192.168.0.101
..

Iā€™m about to just try reinstalling the component

Hmmmm, okay, something is up. My kodi turned off due to power-saving, and now suddenly the player is playing to nothing

Power off at 5:26PM

Playback starts at 5:26PM
image

Sorry your having such a hard time with this. I canā€™t figure out why there is no error messages. Have you tried viewing the logs directly? I mean look at the actual log file itself. I think looking at the log from HA, you will only see a message if something actually triggers an error. Iā€™m just wondering if there might be some logging going on that for whatever reason is just not being treated like an error (which means you donā€™t see it in HA)

And this is my first custom component. And itā€™s really more of a hack and expand job on the original gmusic_switch. There are some people using this with no issue but itā€™s still just as possible that your problem is caused by my lack of real programming skills. Gmusic Player can also stream from a locally running gmusicproxy but that is a workaround for skipping tracks. gproxy should not be required for the music player to function.

If youā€™re just troubleshooting, you can give Chromecast Radio a try. Itā€™s basically the same thing, just different ā€“ Seriously it uses to same methods to start playback on a device, itā€™s just playing web radio-streams. I donā€™t really know anything about the stream (if there restricted to certain areas) but I grabbed the first one from the list.

Might even be able to just try a one off example to check on Kodi.

media_player.play_media

entity_id: media_player.mediacenter
media_content_id: http://vip-icecast.538.lw.triple-it.nl:80/RADIO538_MP3
media_content_type: 'audio/mp4'

Iā€™m trying to resolve the song skipping ahead early issue. Iā€™m running hass.io on a raspberry pi. Will I be able to use the gmusicproxy add-on http://hassio.local:8123/hassio/addon/32961a28_gmusicproxy? Would I need to install docker on the PI?

Im unable to follow your link but

Sorry Iā€™m still running HA old school in a virtualenv. I donā€™t have anything docker or hassio related so I canā€™t say forsure but I think this just needs hassio. Plus I thought hassio is always docker. Just the OS running docker can changes ( Ubuntu , hassOS ā€¦ )

Maybe at @miikkajo can offer some advice on your docker question

Hi, if you are running hassio, you are already running docker and you should be able to add add-ons.
install process is documented on:

feel free to contact if you need help

1 Like

Is there any way to use two different GPM accounts with this? My wife and I both have different playlists!

No, sorry that is something still over my skill level. I havenā€™t had the time to put into learning python as I had hoped. Iā€™m still very much a beginner

No worries. I was thinking I might be able to add a second custom component with custom names

That could probably work.

I used this, my appdaemon version and the original gmusic switch all at the same time without any issues. Now in my case, I was logged in to the same account, 3 times at once using the exact same login and device id. The only restriction that always applies was that I could only stream music from one login at a time.

So I think that proves you could have multiple gmusic_players installed as you stated, they would need different name. In you case because of seperate logins I think it could work and you can both play music at once

This was my problem too for days! Thanks for the help.

I installed it yesterday, I had to put my players inside quotes for it to pick them up, is picks up the name of the Playlist that I have on Google Play Music but it does not play, it just makes to Google home speaker sound and switch off, the one that works is the station and only ā€œIā€™m feeling lucky stationā€ it does not pick up the other stations I downloaded to library. On Playlist it does not show the Playlist cover and it does not play, on station it shows and plays a song from Iā€™m feeling lucky station, I also want to know if I can play this via an automation.

Anything in the logs when you try to play from a playlist?

Usually this is because of using the wrong type of device id ā€“
For example a long device id like this will not work

"c0647000ae52d68000e3fbe08a559a000098b500007a00000556cd89be290007"

Make sure your using an android device id. It should be something shorter like this.

    device_id: "21150e2000000456"

It is strange the stations works but not playlist, Iā€™ve never seen that before. But why only one station? :thinking: I know that ā€œIā€™m feeling luckyā€ shows up because I add that from gmusic player itself.

You say you downloaded stations to your library ā€“ Do you mean added them to your library? ā€“ For example from the Google Music website ā€“ you need to add stations to your library or they will not show up in gmusic player.


Short answer is yes ā€“ but Iā€™m sorry I donā€™t have a copy paste example I can provide to you.

Basically you just set the input select to the speakers you want see post here for an example
and the post just below is how someone set the speakers using Node-RED.

Once the speaker are set you can use the medai_player service to control like you control any other service from an automation. ( The first post has media_player services and how they work in gmusic_player ) but the main thing to start playing a certain playlist or station is this.

Thanks, how do I make the play ists play, the stations play but the songs advance faster, I am busy setting up gmusicproxy, so in summary here are my issues:

1.playlists not playing,
2. Which url to use for gmusic proxy, currently using the hassio one but this has stopped even the stations from playing, see attatched yaml

Seems the gmusicproxy has had the negative effect, the stations no longer play, but after removing it, they play again, but advance before the song ends, I also still have the issue with play lists

yes you are on the right path ā€“ gmusicproxy is the only solution to stop songs from advancing to fast.

Your yaml looks correct to me. Iā€™m sorry I do not use anything docker or hassio related so I can not be of much help here. ( I run Home Assistant Core on FreeNAS )

Are there any errors produced in the Home Assistant log when you try to play a song from a playlist.

This seems to be the error:


Sun Feb 16 2020 20:07:49 GMT+0200 (South Africa Standard Time)

Out of range! Number of tracks in track_queue == (0)```

Thatā€™s the error, I cleared all the logs and tried again, and get the same error

:thinking: That should not be the case. Gmusicproxy is itā€™s own thing, Can you test that it works stand alone? Are you using @miikkajo addon for gmusicproxy? There are other people using this as well. I am not aware of any breaking changes between miikkajo addon and this gmusic player.

getting the gmusicproxy to work outside gmusic player is a seperate thing. Solving that is needed to fix song advance but I donā€™t think gmusicproxy will solve the playlist issue.

Well that seems like there are no songs in the playlistā€¦

Can you go to the Google music web page and make a new playlist with exactly 3 songs and then restart Home Assistant ā€“ Does the new playlist show up ā€“ Can you play any of the songs in the new playlist?

I see there are other things I must do to activate/authorise gmusicproxy, in terms of Playlist I created a new one with three songs, still get same errors, I might have to reinstall everything it seems