Google music in HA

FYI, if anyone is on Home Assistant .91 or greater you need to change a line of code in your switch.py file. On line 17 change:

from homeassistant.components.sensor.rest import RestData

to

from homeassistant.components.rest.sensor import RestData

I was getting an error that it could not find homeassistant.components.sensor.rest and that gmusic would not load. Changing it like above fixed my issues.

1 Like

Can you share your files please? Esp init.py

It may be better if someone could put the modified files on a github repo

Sharing the file would be awesome.
I never could get it to work.

My config is already on GitHub, maybe you could do that too?

I thought I had a workaround for the Config Entry errors.

Removing those entries from gmusic.yaml and instead adding them to gmusic/switch.py did in fact stop the warning message and GM continued to work through 91.4

Today I upgraded to HA 92.0 and unfortunately the GM custom switch now prevents HA from starting. :frowning:

Iā€™m still not receiving any error messages but HA just hangs about halfway through startup. Removing the GM switch resolves the issue and HA starts as expected. I was not expecting this to be a breaking change until next release.

So it dies as of 0.92? I had silently prepared myself for it, but was expecting it to come from the Google side, not Hass

check out troy`s post: Google Music in HA -- Using AppDaemon Soon :tm:

@Danielhiversen you see us struggleing? :roll_eyes:

Were you able to get it to work? I donā€™t have appdaemon installed, but would to keep this component working

Not yet - But very soon - atm getting an KeyError - But I use Hassio on Ubuntu. on FreeNAS its working already

Is it Has.io thatā€™s the problem? I run manual in Venv, similar to @troy

And the struggle is real :rofl:

Iā€™m fairly certain weā€™ll be able to keep Google Music in Home Assistant one way or another. I have
the (appdaemon version) working in a virtualenv and on my hass.io virtual machine. I donā€™t normally use hass.io so itā€™s taking a little help from others to get the bugs out

@ajfriesen @tc23 @MomoB @mouth4war @HypnoToad

troy got it working with Appdeamon Google Music in HA -- Using AppDaemon

@Underknowledge @ajfriesen @tc23 @MomoB @mouth4war @HypnoToad

I hope you still consider to have a look at my expanded appdaemon version of this in the future.
Iā€™ve just put the files on GitHub and updated this post with all the linksā€¦



In other news I also have this custom_compent working in Home Assistant 92.1

image

To workaround the invalid platform keys warning

:tada: This should be fixed now! :tada:

image
Please use the updated files at the links below.


:tada: UPDATED: May 11 2019 :tada:

Here are links to my modified files on GitHub

Basic Home Assistant config package
homeassistant/packages/gmusic_switch.yaml

Gmusic custom component files
homeassistant/custom_components/gmusic/__init__.py
homeassistant/custom_components/gmusic/manifest.json
homeassistant/custom_components/gmusic/services.yaml
homeassistant/custom_components/gmusic/switch.py

More about these changes and extra files here

1 Like

Thanks a lot. I was not planning to update to 92.1 because of the risk to loose this custom component but I will give it a go then !

@troy, interestingly, the custom component is able to turn on and play music, but it doesnā€™t seem able to turn it off? On 0.92.2. When I toggle the switch off, nothing happens and music continues to play. And thank you so much for doing great work on this component!

@tc23 Did it work differently before? I just added the extra files, I did not really change any code in the component. It could be related to the missing previous next controls.

I have my appdaemon version of this working very well now. Iā€™m starting to work on creating a new custom component for this. I just need to figure out if this should be a new custom component or if it should be a new platform for the media player component.

1 Like

In the prior custom component, it stopped the music as well. But itā€™s alright, I just added a node red automation to turn off the respective Media players when the switch turns off. Iā€™ll probably switch over to the appdaemon, but needed the custom component for the interim.

Hey everybody! Iā€™ve updated these files on github.

  • The previous ā€œConfig Warningā€ workaround is no longer required!
    Settings have moved back into packages/gmusic_switch.yaml.

  • The media_player will now power off when the gmusic switch is turned off @tc23

  • Removed unnecessary code

If your were using these files before May 11 2019, you should update ALL the files


1 Like

Thanks so much @troy! You the real MVP!

Iā€™m not seeing the media player turn off when the switch is turned off. I see @tc23 added this in a script but not in the code? Maybe Iā€™m missing it.