I am new to ST and just built my first dashboard. I have connected my Google Home Mini through Home Assistant but can’t seem to get the next and previous tracks to work on the music tile. I am able to control the pause and play and it works fine on my Echo just not the mini. Any thoughts?
Can you try reauthorizing the Google Home Mini to SharpTools while you are actively playing some content on it?
If I remember correctly, there’s an interesting implementation with the Home Assistant Google Home Speaker integration where the next/previous track capability only shows up when the device is actively playing music when it is synced.
Thanks Josh, I tried to reauthorize while content is playing and it’s still not working.
Can you clarify what’s happening?
Sure, I added the device tile to the dashboard for the mini. Music plays and I am able to pause and start the device but the next track and previous track buttons are not working. When pressed it says the command is sent but continues to play the current track. When I click the adjust button I get the same issue. Pause and Play work but not next and previous tracks. This all works with echo not with the mini.
Interesting. I’m not experiencing the same thing with my Google Home speakers connected to Home Assistant.
The next/previous buttons call the standard media_previous_track
and media_next_track
services in Home Assistant. Here’s a snippet of my Add On logs for the last click of the ‘previous’ button in the video above:
2023-12-11 09:56:52 info: Received command call_service from SharpTools.io.
2023-12-11 09:56:52 debug: Received command. {"entityId":"media_player.upstairs_spare_room","type":"call_service","data":{"domain":"media_player","service":"media_previous_track"}}
2023-12-11 09:56:52 debug: Converting service command for domain media_player and service media_previous_track
2023-12-11 09:56:52 debug: Call HA service - {"id":542,"type":"call_service","domain":"media_player","service":"media_previous_track","target":{"entity_id":"media_player.upstairs_spare_room"}}.
If you call that service from Home Assistant’s developer tools while a song is playing on your Google Home Mini, does it change to the next track?
Yes Just tried it and it does advance to the next track
Can you check your Add On logs and share the snippet that matches my log from above?
If you used the ‘Choose entity’ option in the Home Assistant Developer Tools along with the Media player: next
service and made sure it was the exact same entity id (in SharpTools and in HASS), it should be the exact same command.
Verify the media_player.media_next_track
service is selected
Verify the exact same ENTITY id was selected
Diagnostics Export
If that doesn’t provide any clues, can you send a note to support@sharptools.io with a diagnostic export with all the boxes checked from the Home Assistant Add-on along with the Device ID in question and the approximate time and timezone you tried the Next Track command from SharpTools?
It looks like the entity names are the same in both ST and HASS
2023-12-11 18:06:29 info: Send media_player.office_speaker’s state_changed event to SharpTools.io.
2023-12-11 18:06:30 debug: Received state_changed event for media_player.office_speaker from HA.
2023-12-11 18:06:30 debug: Removed media_position attribute from entity (media_player.office_speaker) event because it is not subscribed.
Thanks for sharing. That looks more like the Add-on receiving a status update from the speaker and then filtering it out since it’s not subscribed rather than the command logs.
You should be able to open the logs screen, send the command from SharpTools, then refresh the logs and it should be close to the bottom of the log entries. Here’s a snippet from my logs again as a reference:
2023-12-11 17:15:16 info: Received command call_service from SharpTools.io.
2023-12-11 17:15:16 debug: Received command. {"entityId":"media_player.upstairs_spare_room","type":"call_service","data":{"domain":"media_player","service":"media_next_track"}}
2023-12-11 17:15:16 debug: Converting service command for domain media_player and service media_next_track
2023-12-11 17:15:16 debug: Call HA service - {"id":546,"type":"call_service","domain":"media_player","service":"media_next_track","target":{"entity_id":"media_player.upstairs_spare_room"}}.
So if you send the command, then refresh the logs, it should be in the bottom ~20 log entries most likely. You’re looking for the sequence that starts with an info log entry of:
Received command call_service from SharpTools.io
Then after that will be the details about the command and the conversion as debug entries:
Received command. {"entityId":"media_player.YOUR_ENTITY_ID","type":"call_service","data":{"domain":"media_player","service":"media_next_track"}}
Converting service command for domain media_player and service media_next_track
Call HA service - {"id":546,"type":"call_service","domain":"media_player","service":"media_next_track","target":{"entity_id":"media_player.YOUR_ENTITY_ID"}}.
In other words, you should be able to use your browser’s search feature to look for Received Command and it should be the very last match if you refreshed the logs immediately after sending the command.
Sure, I ran the service and refreshed the log and these are the last two entries:
2023-12-11 18:21:54 info: Received command call_service from SharpTools.io.
2023-12-11 18:21:54 debug: Received command. {“entityId”:“media_player.office_speaker”,“type”:“call_service”,“data”:{“domain”:“media_player”,“service”:“media_play”}}
2023-12-11 18:21:54 debug: Converting service command for domain media_player and service media_play
2023-12-11 18:21:54 debug: Call HA service - {“id”:2,“type”:“call_service”,“domain”:“media_player”,“service”:“media_play”,“target”:{“entity_id”:“media_player.office_speaker”}}.
If that’s the case, then it sounds like the command is not being sent to your Home Assistant instance. You tried sending the command, refreshing the logs, then using the ‘Find’ feature within your browser to look for ‘Received command’ (no quotes)?
Edit: I noticed that you edited your post and you’re at least seeing the media_play
command that you would expect to see when tapping the play button. If you send the ‘Next’ command, refresh the logs, then using the ‘Find’ feature of your browser to look for ‘media_next_track’ (no quotes) are there any matches?
In a previous reply, you mentioned that you were seeing a green ‘Command sent’ message when you tap on the next and previous tracks like you do when tapping play or pause SharpTools. Is that still the case?
It would also be helpful to have the details from the Diagnostic Export section of my previous reply so I can take a closer look.
It is now working when I tap next track on the dashboard on the iPad. This is what matches the browser search for ‘media_next_track’
2023-12-11 18:44:33 info: Received command call_service from SharpTools.io.
2023-12-11 18:44:33 debug: Received command. {“entityId”:“media_player.office_speaker”,“type”:“call_service”,“data”:{“domain”:“media_player”,“service”:“media_next_track”}}
2023-12-11 18:44:33 debug: Converting service command for domain media_player and service media_next_track
2023-12-11 18:44:33 debug: Call HA service - {“id”:5,“type”:“call_service”,“domain”:“media_player”,“service”:“media_next_track”,“target”:{“entity_id”:“media_player.office_speaker”}}.
2023-12-11 18:44:33 error: Failed to call service through WS connection. Entity media_player.office_speaker does not support this service.
2023-12-11 18:44:33 debug: Responding to socket message f92609e5-0913-4388-8edc-cdc89c8aab70. Data size: 0.02KB.
It looks like the last screenshot of the logs was successful so perhaps it matches that attempt.
I presume this log snippet is from an attempt that failed. I’ve seen this message occur when an attempt is made to send a next / previous command while the Google Home speaker isn’t actively playing anything or is in between playback states (eg. when the buttons in SharpTools are greyed out).
The Google Home integration with Home Assistant is kind of unique in that respect. The ‘services’ for next/prev are removed from the device depending the playback state.
For example, if you ‘stop’ music on a Google Home device (eg. “Hey Google, Stop”), it loses the context of being able to resume and use the next/prev commands in HASS. If I remember correctly, it can also lose its context even when it has been paused for an extended period of time. At which point you would need to queue some music up again (eg. via voice, automation, etc)
Yes, that is exactly what happened. I pressed play on the dashboard prior to setting the device on Spotify so it played to the iPad not the mini. The second one was a success message. Seems to be working on all the minis in the network. Appreciate the help!!! Thanks