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

@christophe.vandingel

Does anything else work? Can you make a test playlist with songs only available through all-access ( nothing you uploaded ) Is this limited to music you have uploaded or everything?

I would almost 100% agree. Are you using a username name and password for gmusic_player ? Or have you configured the Oauth login - I never accounted for the local setting, so it’s always using the default en_US. I don’t really have any other guess to what may cause this trouble.

What is the ID for your local? See this list – I’ll make a modified version for you to test


@sparkydave

Do you have at least one playlist, that you created, saved in your Google Music Library? Currently, this does not support any auto generated playlist. An empty playlist will not work either. A playlists must contain at least one song or it will not be added to gmusic_player.

Same goes for the stations – You will only see stations you have added to your media library but you should at least see one station - “I’m Feeling Lucky”

I did another HA restart and it seems to have fixed the issue however how do you start the music playing? I have tried selecting stations or playlists and nothing starts…

There’s a few ways. For basic control from the gui, after you select your station or playlist and speakers, you should just need to turn on gmusic_player

image

For automations or other ways to trigger you can use

1 Like

is it possible to just run the script ‘gmusic_play_media’ and have it use which ever items are already selected for speakers, source and name?

In this case you can just use media_player.turn_on

No Sorry - The purpose of this script is to set everything.

Hi Troy

I also tested it with a self-made playlist that had only Google music on it, not uploaded by me, that also didn’t work. The code for Belgium is nl-BE. I have a username and an app password, cause I’m having 2-factor. Hope we can find what’s going on, cause I really like this plugin.

Regards
Christophe

Ps: I also read something about a url you can give it, so, you would be able to load another online playlist? (Thinking of YouTube music, since Google play music is about to go away in the future)?

I have installed the gmusic proxy to try and prevent songs not playing to the end but I dont have good linux skills to get the credentials setup. How to I start a bash session in the container?

Try portainer

Dave…
docker exec homeassistant /bin/bash
(I think) from ssh…

I’ve installed the Portainer add-on and can see the Image for gmusic proxy… no idea where to from there

No luck with that:

~ $ docker exec home assistant /bin/bash
-bash: docker: command not found

You need to do it via ssh to the host… it’s impossible that you don’t have a docker command.

Note no space in homeassistant- auto mangle…

Docker exec -it homeassistant /bin/bash

I was missing the -it… but it should not give the error you reported…

solution at 3° post (mikkajo)

Are you referring to the gmusicproxy url? If your not using gmusicproxy, I recommend that you give that try first – It is possible that alone could fix your issue – You will likely need gmusicproxy anyways to prevent tracks from cutting off in the middle of a song


If that does not work…

From my point, it is easier to add the local setting for the Oauth login – I still can not say if the local setting will even fix the url issue ( hopefully gmusicproxy will fix ) I switch to using Oauth login about year ago and it does work with 2-factor enabled. But now, I’m having a hard time switching my account back the username and password login :thinking: I’m not going to be able to test the local setting with the username login unless I can figure out why it stopped working for me. Honestly instead of troubleshooting my own username login, I would rather help you get an Oauth login setup - If it is somehow possible

The difficulty switching to Oauth comes when trying to creating the Oauth Credentials file ( you only need to create this file once ) Creating the file itself if not terrible but I only know how to do it using the command line. If you are running Home Assistant Core in a virtualenv, I can help you create this file – But I can not help most people because I do not use the former named HassIO or any kind of docker setup. You would somehow need to get to the command line of the actual container that is running HA and I do not know how to help with that.

Another option, if you have a Linux computer, it is also possible to create a temporary virtualenv with gmusicapi installed and use that to create the Oauth Credentials file. That credentials files can then be copied to HA and used by gmusic_player.

Another option, if you have a Linux computer

I have the ‘HassIO’ running in docker, on a Linux computer, so I have a Linux computer. I only hope I’m advanced enough to follow the instructions (I’m not that good, but keep that quite :wink: )

I have setup gmusic component as per instructions
But it only showing on off
And few automations
I also added input sources to gmusic_config but my sources media player doesnt showing in sources , i have gmusic paid subscription
Whenever i start gmusic this msg popups (when click on turn on and off) its showing off by default)

Failed to call service homeassistant/turn_on. Unable to find service input_select/turn_on

Failed to call service homeassistant/turn_off. Unable to find service input_select/turn_off

Playlist and my radio not fetching, but my account configuration is correct.
Help me plz

The is alot going wrong here – Please completely remove the gmusic_player, including removal of both package files – and then restart Home Assistant before you try again.

Please try again - Please get new downloads of both package file.

Set your speakers in gmusic_config.yaml

## Use this 'package.yaml' file to configure "gmusic_player"
media_player:
  - platform: gmusic_player
    device_id: !secret gmusic_device_id
    username: !secret gmusic_username
    password: !secret gmusic_password
      
    ## Add your media_players below
    speakers: # Example media_players
      - bedroom_stereo
      - workshop_stereo
      
    ## Optional: enable streaming from gmusicproxy (Workaround for issue #6)
    ## https://github.com/tprelog/homeassistant-gmusic_player/issues/6
    #gmusicproxy: !secret gmusic_proxy

Do not edit - gmusic_player.yaml


After new packages files are placed

  • Reinstall gmusic_player
  • Restart HA

HA 0.107 changes everything! - more on that in a later post


Just to recap - I have mentioned this a few places before

You see I am not a programmer. Honestly my only initial intention was just trying to keep the original gmusic switch working. I never thought I would even get this far. So bottom line is, getting gmusic to work in HA is my first attempt at any Object Oriented Programming, learning Python general, and creating a custom component for HA. I’m also not the smartest, so learning all these things from the internet is a slow for me.

I do want to keep working and moving forward with this, I just can’t do it as quick as I would like


With most of the world on pause right now, I have some free time to revisit learning python.

I still have more questions than answers but I’m happy to report I’m making some progress.

Click HERE to see spoiler

image

image

image

image

image

3 Likes

With the patience and help of @christophe.vandingel - I have finally been able to track this down. It seems to be an issue, when the track id contains a hyphen ( - ) it needs to be in quotes

  • "36b2a8ac-8bd3-3894-ac9a-8c0ece109748"

If your having this issue you can update to the latest master version using HACS to see if it helps
( Hint: Select master from the drop down menu )

:man_facepalming: Completely forgot… media_player.media_play will do what you want

  • It will turn on and start playing using whatever selections are currently made
  • entity_id: media_player.gmusic_player
1 Like