Google music in HA

DUDE!!!

IT FSADFIHADGSLKDGNSDOGI WORKED!!

Hahaha! finally, thanks A LOT MAN! Highly appreciated!

Its working on all devices!

A few questions though, how to skip track? and also, none of the playing track information are visible , is that normal?

Remove it, and chuck in a random string. Restart ha.

Check the error. It’ll say something like ‘Id must be 16 digits long’, change your random string to be the number of characters it needs to be, restart ha, check the error.

It’ll now say 'invalid id, valid ids for this account are… " copy the one that’s the same number of characters as you just used.

Restart HA and you should be gold.

Yeah, I don’t get track information.

Skip is done on the media player buttons.

I feel accomplished! Thanks a LOT!

Still long way ahead, so i’m using smartthings mqtt, all i want is to wake up on my playlist automatically (currently i have a routine on ST that will start with a button, i just need to add HA to it, i know how it would be done from ST, but i’m missing the link of how to automate it…

Either I have ST someway send to HA or have HA do it, any suggestions?

link removed

Change the service at the very bottom to switch.turn_on switch.google_music, and change the entity_id in the service immediately above to media_player.chromecast

You’ll also need to edit (or remove) the device tracker condition in the automation to suit your configuration.

Thank you, however, I prefer to have all my automation remain on ST, and have it somehow triggered in HA, so, I created a virtual switch in ST, and added it via MQTT to HA, so now what i need to do is the following in HA,

If that switch is triggered ON then turn ON the gmusic switch…

My code is as follows:

- platform: mqtt
  name: "Wake up"
  qos: 0
  optimistic: true
  command_topic: "smartthings/Wake up/switch"
  payload_off: "off"
  payload_on: "on"
  state_topic: "smartthings/Wake up/switch"
  retain: true

So how to create that automation?

Use that switch as your trigger, and then action to switch on the gmusic switch.

Exactly thats what i need to do, i’m trying to read and catch up from any templates but man its so damn hard!

This doesn’t need a template, just a simple trigger and action.

As a point of interest, if you had copied the code I posted, made the 3 changes I suggested and restarted ha, you’d now have a fully functioning alarm clock and zero stress :stuck_out_tongue_winking_eye:

Haha, the thing is I didn’t want an alarm, I have a Good morning routine that I did in seconds in ST, i believe to do it in HA it will take me ages, so i thought it would be easier to do what i’m doing…

I tried this but its not working:


automation:
trigger:
    platform: mqtt
    topic: smartthings/Wake up/switch
    # Optional
    payload: 'on'
action:
  - service: notify.ios_iphone
    data:
      message: Test
  - service: switch.turn_on
    entitiy_id: gmusic


You set up an mqtt switch didn’t you?

If so…

automation:
  trigger:
    platform: state 
    entity_id: switch.wake_up
    to: 'on'
  action:
    - service: notify.ios_iphone
      data:
        message: Test
    - service: switch.turn_on
      entitiy_id: switch.gmusic

Double check the entity_ids for both the mqtt switch and the gmusic switch in the states panel.

Yes MQTT is setup and the event is received in HA but still didn’t work, I tried your config and I tried this too:

automation:
trigger:
    platform: mqtt
    topic: smartthings/Wake up/switch
    entity_id: smartthings/Wake up/switch
# Optional
    to: 'on'
action:
  - service: notify.ios_iphone
    data:
      message: Test
  - service: switch.turn_on
    entitiy_id: switch.gmusic

HA Log:

2018-02-17 06:05:23 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on smartthings/Wake up/switch: on
2018-02-17 06:05:23 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on smartthings/Wake up/switch: on

In all honesty mqtt is a mystery to me, and I can’t see why that wouldn’t work.

@Danielhiversen thanks for this. It works perfect! Just wondering if you’re thinking of adding track metadata to the plugin.

Got the same hardware with hassbian.
Still the same setup as you posted before, or do you took other steps as well?

Sorry, I don’t even use this anymore. I got a whole bunch of Google Home Minis during a promotion, and don’t even use Echo Dots for music. I just use GHM for Google Music.

I’m trying to install this again on my new system, but I am getting the following errors:

Error loading custom_components.switch.gmusic. Make sure all dependencies are installed
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py”, line 142, in get_component
module = importlib.import_module(path)
File “/usr/lib/python3.5/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 986, in _gcd_import
File “”, line 969, in _find_and_load
File “”, line 958, in _find_and_load_unlocked
File “”, line 673, in _load_unlocked
File “”, line 673, in exec_module
File “”, line 222, in _call_with_frames_removed
File “/home/homeassistant/.homeassistant/custom_components/switch/gmusic.py”, line 10, in
from gmusicapi import Mobileclient
ImportError: No module named ‘gmusicapi’

I’m not sure what the problem is, because I have installed gmusicapi. I am a manual install with virtual environment. I have custom_components owned by homeassistant user. Do I need to install gmusicapi in the virtual environment? I am 0.64.2

Yes, you need gmusicapi in the virtual environment (I’m running HA 0.65 on virtual environment with Python 3.6.3 however it is the same on 0.64).

Thanks! I will give that a go and see if it installs properly!

Edit: That did the trick!

@Danielhiversen Great add on! I was able to get it set up and play based off rfid cards. Here’s a video of it in action.

7 Likes