Im sorry your having problems with this. I hope a reinstalling gets it sorted. I haven’t given up on this project but I also have not had the time to put toward properly learning python. This really needs to be re-written from the ground up by someone who actually knows what they are doing!
Thank you for your efforts. I managed to install and oauth the gmusicproxy and I can see it on the ui, however I am still unsure of the ip to use
Sorted gmusic proxy, will fight the Playlist issue another time.
Update Available in HACS
I’ve pushed a small update for gmusic_player.
Updating From a Previous Version
Changes to gmusic_config.yaml
- speakers are now configured under the gmusic_player platform settings
You’ll need to (re)configure your speakers ( and gmusicproxy, if applicable )
Changes to gmusic_player.yaml
- added two scripts that will fire events to gmusic_player
gmusic_player.yaml
should be used as it is provided. There is no need to edit this file.
script.gmusic_sync_media
- Update playlist and stations without restarting Home Assistant
script.gmusic_play_media
- Easier way to start play black. You can use this in automations
- This will also set the corresponding input_selects
Example using the new scripts to create shortcut buttons in mini-media player
entity: media_player.gmusic_player
type: 'custom:mini-media-player'
artwork: cover
source: icon
volume_stateless: true
shortcuts:
columns: 3
buttons:
- name: Feeling Lucky
id: script.gmusic_play_media
type: script
data:
name: I'm Feeling Lucky
source: station
speakers: bedroom_stereo
- name: Tool Playlist
id: script.gmusic_play_media
type: script
data:
name: Tool
source: playlist
speakers: bedroom_stereo
- name: Shinedown Radio
id: script.gmusic_play_media
type: script
data:
name: Shinedown
source: station
speakers: bedroom_stereo
- name: Sync Music
icon: 'mdi:sync'
id: script.gmusic_sync_media
type: script
Hi,
Just updated to 0.2 and there’s an error referring to gmusic_authtoken:
FileNotFoundError: [Errno 2] No such file or directory: '/root/.homeassistant/.gmusic_authtoken'
The issue is that DEFAULT_TOKEN_PATH = get_default_config_dir() + '/.'
in media_player.py doesn’t get the correct path on my install (formerly known as Hassio) so I changed it to DEFAULT_TOKEN_PATH ='/config/.'
Hi @Petrica
Sorry about that. There doesn’t seem to be a good way I can get the actually configuration directory. ( At least I haven’t figured it out yet. ) There is an optional setting though
You can change the path by setting token_path
in the gmusic_config.yaml
package file.
Example
## Google Music Media Player
## gmusic_config.yaml
media_player:
- platform: gmusic_player
device_id: !secret gmusic_device_id
username: !secret gmusic_username
password: !secret gmusic_password
speakers: # media_players
- bedroom_stereo
- workshop_stereo
gmusicproxy: !secret gmusic_proxy
token_path: /config/.
haven’t got to that section of the instructions as the previous version just worked without it.
Thanks!
The previous versions used DEFAULT_TOKEN_PATH = "./."
I’m surprised to hear that actually worked
It did seem to work in the FreeNAS plugin as well - I’m just gonna revert that change.
I reverted this change in v0.2.1 It should work again without setting token_path
Thanks for letting me know about this!
Hi There,
The media player seems to be broken, I reinstalled the player to no avail, it gives me the screen below:
my config is as follows:
## Google Music Media Player
## Use this 'package.yaml' file to configure "gmusic_player"
media_player:
- platform: gmusic_player
username: !secret gmusic_username
password: !secret gmusic_password
device_id: !secret gmusic_device_id
gmusicproxy: http://192.168.68.134:9999
input_select:
gmusic_player_speakers:
name: Speakers
icon: mdi:speaker
## Add your media_players below
options: # Example media_players
- mainbedroom_tv
- mainbedroom_speaker
and the player is as follows:
## Google Music Media Player
## Supplemental 'package.yaml' file for "gmusic_player"
input_select:
gmusic_player_source:
name: Source
icon: mdi:library-music
options:
- "Playlist"
- "Station"
gmusic_player_speakers:
name: Speakers
icon: mdi:speaker
options: ## Should be empty
- " "
gmusic_player_playlist:
name: Playlist
icon: mdi:playlist-music
options: ## Should be empty
- " "
gmusic_player_station:
name: Station
icon: mdi:playlist-music
options: ## Should be empty
- " "
script:
gmusic_sync_media:
alias: gmusic_player.sync_media
description: 'Update song list from Google Music'
sequence:
- event: gmusic_player.sync_media
gmusic_play_media:
alias: gmusic_player.play_media
description: 'Fire event: gmusic_play_media'
fields:
speakers:
description: Name of the speakers to play music on.
example: bedroom_stereo
source:
description: Media Source. Should be 'station' or 'playlist'
example: station
name:
description: Name of the station or playlist.
example: I'm Feeling Lucky
sequence:
- event: gmusic_player.play_media
event_data_template:
speakers: "{{ speakers }}"
source: "{{ source }}"
name: "{{ name }}"
shuffle: " {{ shuffle }}"
shuffle_mode: " {{ shuffle_mode }}"
## Sensor used for auto track advance.
sensor:
- platform: template
sensors:
gmusic_receiver:
value_template: "{{ states.media_player.gmusic_player.attributes._player_state }}"
automation old:
- alias: "gmusic_player_auto_advance"
initial_state: 'on'
trigger:
platform: state
entity_id: 'sensor.gmusic_receiver'
from: 'playing'
to: 'idle'
for:
seconds: 1
condition:
- condition: state
entity_id: 'media_player.gmusic_player'
state: 'playing'
action:
- service: media_player.media_next_track
entity_id: 'media_player.gmusic_player'
- alias: "gmusic_player_auto_play"
initial_state: 'on'
trigger:
platform: state
entity_id: 'media_player.gmusic_player'
from: 'off'
to: 'idle'
action:
- service: media_player.media_play
entity_id: 'media_player.gmusic_player'
homeassistant:
customize:
media_player.gmusic_player:
friendly_name: "Google Music Player"
sensor.gmusic_receiver:
friendly_name: "Google Music Receiver"
hidden: true
script.gmusic_sync_media:
friendly_name: "Sync Music"
icon: mdi:sync
script.gmusic_play_media:
hidden: true
## This group may only be visable when using the "states UI"
group:
google_music_media_player:
name: Google Music
entities:
- media_player.gmusic_player
- script.gmusic_sync_media
- input_select.gmusic_player_speakers
- input_select.gmusic_player_source
- input_select.gmusic_player_playlist
- input_select.gmusic_player_station
I have not changed the files in the custom_components, what could be the problem, I’m running 105.5 and HassOS 3.11. I need help…
Ok, just saw the notes on the update, I will have to re-do everything…
You shouldn’t have to redo everything. Just copy the new config files into place. The biggest change is that speakers are configured under g music player instead of as an input select. Then just add your g music proxy back in to the new config and you should be good to go
Hi,
I am already redoing it, I’ve deleted everything now, I am thinking maybe I am doing something wrong by tinkering here and there. I’ll Feedback in ten minutes
Regards,
CN
Hi, I have no luck at all, music player does not even appear in entities…
This custom component works really well for me, thanks @troy
Is it possible to use friendly names for the speakers?
I’ve tried a few times to do this. I haven’t had any luck getting it to work but I’m sure it’s possible.
I’ll have another go it but I can’t make any promises.
Thanks for everything you’ve done on this and how responsive you’ve been to everyone! I appreciate it and I’m sure everyone else does too.
Is it possible to view automatic playlists like my Thumbs Up one?
So for automatic – I don’t know about playlist but it is possible for stations. It’s just that its all or nothing. So for example right now I filter the stations to only include what’s in you library – Without that filter the list of stations is over 200 long. I don’t have a better to allow some automatic stations but not others.
But for thumbs up playlist I think I could add this – Assuming I can filter the same way I do for the stations, I can just look for songs with a thumbs up and only add those songs to a dedicated “Thumbs Up” playlist.
I’ll have a look and see what I can do.
Is there a possibility that you’re willing to share your theme (including the background) and the code to implement it. I like it very much. (I’m only a beginner, that’s why I ask for the code too)
Hi troy, I’m giving it a try too and have the same problem as @dasbooter, I get the error that it failed to get the URL for the track, but I get it with a playlist. All my music is my own and uploaded, I am a subscriber, and I can play everything in the google music app. I’m not in the US, but I think that shouldn’t make a difference, especially for playlists.
I’ve just set this up but I get the below error if I try to sync. Currently I have no playlists of stations showing up in HA.
Logger: homeassistant.core
First occured: 10:34:43 AM (8 occurences)
Last logged: 11:49:30 AMError doing job: Future exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/gmusic_player/media_player.py”, line 406, in _update_sources
self._update_playlists()
File “/config/custom_components/gmusic_player/media_player.py”, line 431, in _update_playlists
self.hass.services.call(input_select.DOMAIN, input_select.SERVICE_SET_OPTIONS, data)
File “/usr/src/homeassistant/homeassistant/core.py”, line 1168, in call
self._hass.loop,
File “/usr/local/lib/python3.7/concurrent/futures/_base.py”, line 435, in result
return self.__get_result()
File “/usr/local/lib/python3.7/concurrent/futures/_base.py”, line 384, in __get_result
raise self._exception
File “/usr/src/homeassistant/homeassistant/core.py”, line 1208, in async_call
processed_data = handler.schema(service_data)
File “/usr/local/lib/python3.7/site-packages/voluptuous/validators.py”, line 208, in call
return self._exec((Schema(val) for val in self.validators), v)
File “/usr/local/lib/python3.7/site-packages/voluptuous/validators.py”, line 287, in _exec
raise e if self.msg is None else AllInvalid(self.msg, path=path)
File “/usr/local/lib/python3.7/site-packages/voluptuous/validators.py”, line 283, in _exec
v = func(v)
File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 272, in call
return self._compiled(, data)
File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 817, in validate_callable
return schema(data)
File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 272, in call
return self._compiled(, data)
File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 594, in validate_dict
return base_validate(path, iteritems(data), out)
File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 432, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: length of value must be at least 1 for dictionary value @ data[‘options’]
I have no idea how to fix this…