I finally tried to set this up, but I am getting a blank playlist input_select. Have you run into this? I am using the legacy login and wondering if it is actually connecting. Is the RW access to the token required?
Hi @tc23
Yes the location for the access token needs to be RW. With the legacy login it will create the temporary token for you. It will need RW access to create the token.
Any error message in the logs related to gmusic?
OK, so I gave the file google.token
RW access but I am still getting empty values for the playlist. The only error that I am getting is this
Could not render template gmusic_receiver, the state is unknown.
Is .google.token
the right name of the file I should be giving RW access too? Any chance the Google calendar component is conflicting with this?
I think for the legacy login the token will be gmusic_authtoken
or .gmusic_authtoken
If there is a .
at the beginning, that makes the file hidden on a Linux system. When you configure the legacy login you can not change the name of the access token. It will always be gmusic_authtoken
and this file will be created for you. You should not try to create the file on your own.
In the configuration file packages/gmusic_player.yaml
the token_path
on Line 23
should point to a directory, not to a file.
## Optional for legacy-login - Directory with RW access for "gmusic_authtoken"
token_path: '/config/.'
A little trick here. In the lines above I have token_path: '/config/.'
Notice how I have .
at the end of '/config/.'
This will create and access token /config/.gmusic_authtoken
so the file will be hidden.
Conversely, if I instead used token_path: '/config/'
(with no .
at the end) I would instead end up the access token /config/gmusic_authtoken
and the file would be visible.
So in other words you can use a .
to control if the file is hidden or not but you can not change the name itself. The name will always be gmusic_authtoken
. I hope that helps make some sense.
regardless the place to configure the directory to store the access token is set on Line 23
packages/gmusic_player.yaml
This must be a directory and the directory must have RW access. If your still having troubles please share what you have configured on Line 23
so I can see an idea of what your trying to do.
I have gone back to the check the code. Look like I did put an error ff the legacy login fails. It should be something like "Failed legacy log in, check http://unofficial-google..."
Hi @troy, thanks for the welcome! While itād be nice if there was a simple copy/paste solution, I wasnāt expecting there to be. I only just got this up and running, and havenāt had time to dig into the internals too much due to life being life. I was hoping youād at least be able to point me in a direction to look, which you have, so thank you! I will look into setting up an automation that writes the data from the gmusic_player when itās active to the default media receiver instance. Even if itās not easily possible, thanks for work on this plugin. Itās super handy (and fun to watch peopleās reactions when you say āAlexa, itās time to chillā and the mood lighting sets while some background music starts automatically)
Glad youāre liking this. I couldnāt remember before but there is a _player_id:
attribute for media_player.gmusic_player
that will have the name of the connected āDefault Media Receiverā.
Iām not good with templating in HA. Back using the gmusic_switch and I really struggled to figure out how to detect which media_player google music was connected to. Eventually I just gave up and hard-coded the media_player I used most into my automations. I added the _player_id:
attribute just in case there ever was a need to easily know which media_player youāre connected to.
I think that should make things much easier for you
I think I have to try the oauth option, because I have tried 6 ways to sunday to get legacy to work, but to no avail. Iām thinking its the original auth_token which is causing the problem.
The original auth_token file is named .homeassistantgmusic_authtoken
. And this new version doesnāt seem to create a new file (is it supposed too?). I tried to rename it to .gmusic_authtoken
and insert my dir per the above, but nothing I tried seemed to work. For some clarity, here is the last version I tried:
media_player:
- platform: gmusic_player
device_id: 1234
login_type: legacy
user: [email protected]
password: my_pw
token_path: '/home/homeassistant/.homeassistant/.'
Maybe a stupid question but are you sure you have a directory /home/homeassistant/.homeassistant/
If you go to the developer tool > info what does it say your configuration directory is? Just to be sure
For example, here is a screenshot of mine.
So I would use token_path: '/home/hass/homeassistant/.'
But yes this should create the new file for you. I have tried renaming the old file but that will not work.
The only other thing I can think right now is do you use two factor authentication with you google account? ā If so, you need to be using an App Password, not your regular password.
Yep, I confirmed that is the proper path via dev tools. Is the token/oauth file supposed to create itself automatically or is there something that I need to do? Because I tried the oauth login in type as well and that didnāt work either, and no file was created.
Edit: You can forget prior comments haha. I scrapped everything and went back to the beginning and redownload everything from GitHub. Everything is showing up as it should be. Thanks! Sorry for the fire drill!
Hey no worrie. Glad itās working now
Um just one thing I am new so this may be a stuped question but can you give me the basic ui-lovelace.yaml card markup. no idea what to add
thx in advance
I can see this in my unused entities and seems to be working just like to add to my lovelace
Iām happy to share mine but it will require the mini-media-player
cards:
- entities:
- artwork: cover
entity: media_player.gmusic_player
group: true
hide:
progress: true
replace_mute: stop
source: icon
type: 'custom:mini-media-player'
volume_stateless: true
- entity: input_select.gmusic_player_source
- entity: input_select.gmusic_player_speakers
- entity: input_select.gmusic_player_playlist
- entity: input_select.gmusic_player_station
type: entities
type: vertical-stack
Hereās how that looks. OFF and ON
You can make your own simple card view using an entities card
Just start typing gmusic
and it will give you a list of thing to add related to gmusic
These are the 5 entities you will likely want.
The others things donāt really need displayed but no harm adding them if you want
thx this looks perfect
Is there a way to change the āspeakersā value thru some code or something, instead of thru the interface?
I have gmusic currently running now (and itās great, thanks!!!), but Iām used to the node red side of things, and am not sure if this is possible or not.
Perhaps some function or service call?
(I took a look for some previous answers, and didnāt see anything come up)
Hello @phreaq
Currently there is nothing built into the GM media player to select speakers but that is something I hope to add when I have time to continue work on this project.
Sorry I can not share anything off the top of my head but I would imagine any type of automation to select values from an input_select would work.
Thanks Troy,
I donāt have much experience in changing the entitieās properties, I tried the below service node, but had no luck.
Anyone have any pointers? Iām sure itās something simple.
tia
I donāt use Node Red so Iām not sure if this will help in any way but for example to select the speakers using the services in HA this should work.
Edit: Just a guess but in your Node Red screenshot, maybe try changing set_options
to select_option
perfect! that gave me what I needed (and yes, I needed the āselect_optionā, among other tweaks)
again, thanks for your help, and your work on this. I used gmusic many moons ago in Kodi, until the 2 step verification broke my build. Iām glad Iām reunited with it again.
for the benefit of others, below is what worked for me.
very welcome addition to my setup, thank you very much.
so far i got it up and running. but i understand how to refresh my stations? i have only 2 from which i can choose āfeeling lukcyā and some random other one. If i call the service with a different station, the log only shows me that I could select from that two. any hints?
edit: nevermind, I didnāt get that these are the stations out of my musiclib and not the one the subsciption provides.