Add nextTrack() and previousTrack() commands to Chromecast Audio device

These would be very handy while listening to playlists.


Add "Toggle Play/Pauze" to

1 Like

My work around to this was to set up a rule that when the button was pressed a conditional rule was ran. If state is playing then pause it... If state is paused then play. It's not perfect but works most of the time.

1 Like

That exactly what I do but there is no solution for nextTrack and previousTrack.

If you are a user of Tasker, there is a media controller option that may of use...

1 Like

At first glance it seems like a convoluted soution. I looked into it superficially and unfortunately Google shared control only include play, pause and sound volume, no next and previous. So I don't think tasker could control music started on another device. (maybe I'm missing something)

The best I could think of is to create a virtual switch to associate with each button action, then use the automations in Google Home to create a "household" routine that uses that switch as a starter.

You would need to create a virtual switch for each action. I would recommend setting the auto off preference to 500 ms.

Then rule or button rule that turns that switch on when the button is pressed (or held, etc)

Then create a routine in automation. The starter would be virtual switch turns on. The action would be "Try Adding Your Own" There, you can type what you would normally say if you were speaking to google assistant AFTER saying "Hey Google". So, if you would say, "Hey Google, next track," then the action would be "Next Track"

Don't know if that would work. But, it's worth a try

Custom Action Type in Google Routine

Not necessarily... I haven't looked at controlling Chromecast media specifically, only media generally. Will see what I can do in the next few weeks.

1 Like

Thanks @tray_e. It works but somehow, I don't feel good about it. Having to rely on a cloud google routine and link several virtual switches to a button seems haphazard to me.

If you are looking for a local option, Chromecast wouldn't be the first choice to begin with. You are going to need an app that streams from a local server that has the previous/next functions built into the app.

Chromecast doesn't really control what you are streaming. It just allows you to do so with the apps that are on it.

Yes and I would like this app to be Hubitat builtin chromecast integration. :slightly_smiling_face:

I know anything google won't work if there is no internet connection and Spotify is cloud streaming but I would like to control it from devices connected to Hubitat without using convoluted workaround. Home Assistant does it so there is no reason why Hubitat couldn't.

I use a Chromecast audio because it allows me to send music through an optical audio link to my HiFI system from a variety of sources.

Home assistant does it through a SPOTIFY app. They don't integrate it with Chromecast. It just so happens that some use Chromecast to stream their Spotify.

But, that also seems to require a separate app to link it to Chromecast in HA unless you want to start the stream from your phone first. So, the HA implementation appears to be a bit convoluted as well.

I was refering to the Google cast integration:

This can be controled by the HA integrated media player. The setup is similar to what Hubitat is doing but with the ability to skip track.

1 Like

So, as I said, that app uses MULTIPLE media players to achieve that goal. It's not built in to their version of Chromecast

We can continue arguing about that but we would be missing the point. My request is simply to be able to issue a nextTrack() command to the chromecast device from within Hubitat.

@tray_e, I wonder, If Home assistent combine MULTIPLE media players to achieve that goal, how is Google it doing in there app in google home? Any idea?

They aren't. They are using the cloud and controlling the parent app on your phone. This is why if someone starts playing spotify at your house, the spotify app will open on your phone and show a notification as it is running in the background.

This is also why you have to link your account in the google home app. Google home isn't the player itself. It just controls the app.

1 Like