Game Time Button

Hi All, I'm relatively new to Hubitat and Home Automation and have only started with a couple of simple automations with hue lights. I have an idea for a cool automation but am not quite sure how to actually pull it off. I am a big Hockey fan and sometimes have friends over to watch games. I wanted to create a rule that triggers a "Game Time" action from a button press.

I have a Samsung Smart Things Button, Google Home, Chromecast, Hue Light Bulbs, and Spotify. My idea for the rule is that when the zigbee button is pressed a few separate actions happen.

  • The hue light bulbs set to a Hubitat Scene of Blue and Gold
  • The song Let me clear my throat plays from spotify over a chromecast device

Then after I push the button again it ends the rule.

Right now I can get the button press to trigger the hubitat scene but am lost when it comes to playing the song. I assumed that I could use google assistant relay to call out the song and chromecast device but cant really find any clear instructions on how to use it.

Following, we have a chromecast tv and it might be fun to set a few automations up with it.

Well, first, is the Chromecast device going to be available if you are watching the game on the TV? Is it Chromecast Audio or A google Home speaker? How do you have it set up to connect to Hubitat? The hubitat native beta app or some other community method?

If you have it set up with the Chromecast Beta app, there is a command called "Play Track". This allows you to play any music file that the hub can reach ON A WEB SERVER DIRECTLY. The file cannot be on an a Samba server or an FTP server or Google Drive. It must be on a system that delivers the file with an HTTP url. Also, the file must be accessed directly from the link. You cannot have any type of splash page (like the ones you get when you share a dropbox file) first directing you to page to decide if you want to download or save to your Dropbox. This will not work. The cheapeast way to do this is either to check if your router has this capability with an attached USB device. Its a simple free (now) method to do this that if you're only doing it for a few files won't be a problem.
Personally, I use GitHub and use the "Raw File" link to get the URL for the file.

Now simply plug that URL into the command on the edit device page, and POOF your chromecast should play the file. This command is available in Rule Machine under "Control Music Player" sub-menu.

would you be able to do this with a loacal NAS drive, how would you conver the file path to a http?

You can't convert the file path. You need a web server that is able to present the file via HTTP.

Could I do file://

As I have said, several times now, no, you cannot do that. Google does not support those links for playing a file. Only HTTP.

Thanks for that, I'll have a play and see what my Seagate NAS reacts to http

You might have to set it up, but most NAS systems will have an HTTP file server built in. This might be helpful.

The Chromecast I want to control is a chromecast TV that I also pull audio from to go into the whole house stereo. I currently dont have google assistant relay because I dont have an Rpi. I have the chromecast integration app installed but then i would run into the issues you described.

I was playing around in google assistant routines and am able to get the chromecast to play the song from spotify but i have to trigger the routine by speaking the command word to a google home. Is there a way to trigger a google assistant routine from hubitat?

No, routines can only be triggered from Google Assistant devices. You cannot trigger them from Assistant Relay either.

I wish there was even functionality within google assistant for buttons because then I could trigger the routine for music within google home and then have the button also trigger a rule within hubitat.

You could rather just use google to trigger the whole darn thing by saying "Hey google Game time" and set that up as a routine which then pushes a virtual button in HE. Might solve your issue.

That would work too. do you know how to add a virtual button to a google routine?

ive seen a few posts on other forums using a mixture of ifttt and stringify but there has to be a better way lol

thinking out loud

when i added the chromecast integration and linked my hubitat to google home I am able to see a "virtual button" on my google home dashboard for the scenes I have set up in hubitat. I'll have to try activating one of them when I get home from work.

the simple lighting scene in hubitat could be used to set the lights but maybe i could also add a rule that is triggered whenever the scene is triggered. this could open the door to many other possibilities

You can't. Buttons are not supported by the Google Integration. You can add a virtual switch that turns itself off after a pre-determined period of time.

What he said, sorry. I did mean to say switch. I use one in my Assistant good night routine that then triggers HE for night time. I actually use v-switches a lot.

I can confirm that the routine works with the music and the hubitat simple lighting scene.

How do I create a virtual switch that can be used in a Google routine?

On the devices page at the top click "Add virtual device"

Then on the next screen give your switch and name and then for the "Type" drop down box...choose "Virtual Switch", then click save.

You will then see an "Enable auto off" drop down under preferences. It will turn itself off after that pre-set time.

In essence it kind of works like a button. You turn it on...it triggers something...it turns itself off.

will this switch auto populate within google home or do I need to do a manual refresh