Google Music in HA -- Using AppDaemon

Only using my music I uploded to GMusic - Thats why there are no stations loaded .

Did’nt do much - you have set the inital to the playlist

2019-04-28 16:12:42.872731 WARNING AppDaemon: ------------------------------------------------------------
2019-04-28 16:13:01.072722 INFO Google Music: Powered OFF -- Disconnected: media_player.kuche
2019-04-28 16:13:07.091317 INFO Google Music: Powered ON -- Connected: media_player.kuche
2019-04-28 16:13:11.207948 INFO Google Music: --------------------------------------------
2019-04-28 16:13:11.210084 INFO Google Music: Loading [1] Tracks From: Oldscool
2019-04-28 16:13:11.210489 INFO Google Music: [{'kind': 'sj#playlistEntry', 'id': 'dc125a35-d061-316e-9f9d-b42e58c91668', 'clientId': '5c7b09e6-e4d7-4609-82b2-4f7236e7cd84', 'playlistId': '41408b42-ea61-42fc-ab67-347ec4c35e77', 'absolutePosition': '01729382256910270462', 'trackId': '5caef26a-fbd8-3c87-a05b-588473897b10', 'creationTimestamp': '1472161720730418', 'lastModifiedTimestamp': '1472161720730418', 'deleted': False, 'source': '1'}]
2019-04-28 16:13:11.212512 INFO Google Music: --------------------------------------------
2019-04-28 16:13:11.212832 WARNING AppDaemon: ------------------------------------------------------------
2019-04-28 16:13:11.213176 WARNING AppDaemon: Unexpected error in worker for App Google Music:
2019-04-28 16:13:11.213642 WARNING AppDaemon: Worker Ags: {'name': 'Google Music', 'id': UUID('ccc864d5-81e1-4d7b-ae21-e759c1f99962'), 'type': 'attr', 'function': <bound method GMAAC.get_tracks of <gmaac.GMAAC object at 0x7f8afdd57cf8>>, 'attribute': 'state', 'entity': 'input_boolean.gmaac_load_pl', 'new_state': 'on', 'old_state': 'off', 'kwargs': {'new': 'on', 'handle': UUID('81532cb7-b2d3-47ae-9561-310b03d3da5f')}}
2019-04-28 16:13:11.213919 WARNING AppDaemon: ------------------------------------------------------------
2019-04-28 16:13:11.214620 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/appdaemon/appdaemon.py", line 595, in worker
    self.sanitize_state_kwargs(app, args["kwargs"]))
  File "/config/appdaemon/apps/gmaac.py", line 195, in get_tracks
    self.load_playlist(entity=None,attribute=None,old=None,new=None,kwargs=None)
  File "/config/appdaemon/apps/gmaac.py", line 215, in load_playlist
    self.get_track(entity=None,attribute=None,old=None,new=None,kwargs=None)
  File "/config/appdaemon/apps/gmaac.py", line 257, in get_track
    self._song = _track['track']  ## use with playlist
KeyError: 'track'

2019-04-28 16:13:11.214904 WARNING AppDaemon: ------------------------------------------------------------
1 Like

That’s it! Give me some time I can figure how to handle this correctly. Just might take longer because of travel.

1 Like

Neat! :smile:

Seems like @Underknowledge has got this working now also in hass.io
I’ll get everything cleaned up and put on GitHub asap


Edit 05-02

These file have been moved to github.
The first post has been updated and now includes links to the necessary files

Update: Version 0.0.2

I’ve been using this daily in a virtualenv and also testing in hass.io.
I rewrote a few things and cleaned up some code. This version works much better! :tada:

If you were using a previous version, please replace all 3 files.

Home Assistant Package:
homeassistant/packages/gmaac_package.yaml

Google Music AppDaemon:
appdaemon/apps/gmaac/gmaac.yaml
appdaemon/apps/gmaac/gmaac.py


I added prev and next triggers to workaround missing controls in the media player

Update 06/01/19:

Please now consider using gmusic as a media player instead

1 Like

@troy Will this new component work with Hass.io? I tried the appdaemon version but my rpi3 would hang trying to build the wheel for lxml so I never got it working. I was debating the switch to hassbian or a dockerized version or even wiping and reinstalling hassio but was holding off when I saw the development of this component on github

@spelech

Yes It should work with hass.io.

This is the exact reason I tried to build a custom component so quickly instead.

@Underknowledge reported wheel for lxml took as long as 10 minutes to install using an older i7. He was very patient to help me get this working in the beginning on hass.io and I believe he has switched to the this new gmusic_player component for a week or two now and has not report any issues

I personally do not use hass.io

Time for another tread in share your projects :wink: works solid and waiting for a the next updat… Wait there is one :rofl:
You could consider integrating custom updater

1 Like

I absolutely love it - just what I was looking for! Thank you so much!

1 Like

Got it working with oauth, just had to use the gmusicapi elsewhere to grab an old device ID from a phone I dont use. Might want to include some instructions on doing so to get everything into one place and give those an option that dont want to have their google password anywhere in plain text.

On the topic of documentation, I started going through the code for the component. I am no expert in component design but I do program for a living and I was looking at how we could condense the component to not need all the extra switches and look into some of the workaround you have now for speaker changes. At the very least I want to put together a custom card and maybe the ability for various users to use their accounts so they can pull their playlists. I’ll fork and make a pull request when I have something. I am really excited about this component since it really simplifies whole home audio.

The gmusicapi itself makes me want to go and replicate the functionality the app “qcast” used to provide where people could visit a simple webpage and add songs to a playlist that was actively playing. It was great for parties

3 Likes

That would be absolutely awesome.

Looks like you are correct :smile:

@spelech @apop @Anyone following along at home
Let’s move this discussion HERE