Cast from RM4 to google home using assistant relay

So I have several google homes and I run my own windows server. I need to know how to cast a file from a URL to my homes using assistant relay? I have had assistant relay setup and working for awhile now but have never tried to cast an audio file to it from a web server. Can anyone provide any guidance also I have not had my hubitat hub long so I'm still new to RM4.

You cannot do that with Assistant Relay because Assistant Relay does not use the Cast feature of Google Home devices. You need to look at Cast-Web-API and the associated Hubitat Drivers. This will sync your devices with Hubitat and allow you to play a file, via url, on them. The one caveat, the file must be hosted on a web-server and you have to have a valid URL for the file to put into the driver. Git hub is a good place to store your sound files.

Thanks @Ryan780 I had this setup on Smartthings. I installed the app and drivers but when trying to check the api it just forwards me back to the hubitat app page. If I try to browse setup my google home devices I get page cannot be displayed. I have it running on port 3002 currently and can browse to http://10.x.xx.xxx:3002 with no problems although http//10.x.xx.xxx:3002/assistant/setup/ gives me page cannot be displayed. I will keep digging into it though. I appreciate the help sir!

So I notice when I click on setup google assistant with cast to broadcast messages I get page cannot be displayed if I copy and paste the URL which looks normal it actaully has http:// in it twice. (http://http//10.x.xx.xxx:3002/assistant/setup/) Direct copy and paste in quotes. Any Ideas? I can browse to http//10.x.xx.xxx:3002/assistant/setup/ with no problems and setup the configuration with no issues just cannot get it to work in the hubitat app at all. Why would it put http:// in there twice? Anyone else seen this issue?

Ok never mind to early for me I think. I was manually adding the http in the API host address which was causing it to add the additional http:// to the string.

Well I have been able to get this up and running and sent a speak command with success. How do I send an MP3 to it? I have an IIS server up and running and I'm not sure how to setup a rule to send the audio file to the google home.

Use the command Play Track and input the URI of the file. It can also be done from Rule Machine via the play track command under control media players.

Well good news is it put my home hubs in cast mode. Bad news is I casted to my sound bar as well. How can you tell which device is which? Do you just need to test each individually and rename them to the appropriate device name? Also even though it did show it was casting I did not get any audio? Also now without manual intervention it still shows casting. Anyway to have the homes return to normal status after it plays the audio? Also in RM4 I pasted the URL to the sound file in the track name is that correct? Thanks for all your assistance with this one!

Which device did you pick to play the track on? The Cast-Web device or the individual speaker?

I haven’t tried those new drivers you posted yet. Are they better with volume control? HavIng a problem with that again.

I actually chose them all.

I was able to get this working now to figure out how to name each cast device something that is evident where I'm casting the audio too now.

I've taken them down. There are a couple things I working on at the moment so I took them down. But I can PM them to you if you're having issues. The updated version does have both volume and level linked. So, setting level also updates the volume and vice versa. Only problem I am seeing currently is that the fix that was put in for Raise Volume and Lower Volume seems to be reversed unless I am doing something wrong.

Plus, I'm trying to perfect the stop after TTS or play track for the Google Home Hub. I can do it through a timer but that isn't as clean. It doesn't work if you want to play a long track like an alarm noise, occasionally.
Also, I have gotten it worked out through rules to avoid playing the "begin casting" beep that it plays before issuing a TTS or playTrack function when using CATT for broadcasting a camera. I'm trying to work that functionality into the driver presently, since it is just issuing the same commands. I'm also trying to wrap the CATT functionality into the NodeJS server. It seems like it should be fairly easy to work it in via a bash script called from the nodeJS server. I think that might be a bit of a game changer. Now if I could just figure out how to avoid that silly "broadcast from" function.

1 Like

I think I'm OK now on volume. I used "Set volume on [X speaker] to [Level]", where before I was using custom action. Can't recall why I was using custom action, but set volume seems to work fine.

I think custom action > actuator > stop() is working for me. Was the last time I checked.

This is a primary reason I don't like Google Home for TTS. Please tell me how you did this.

Yes, but the timing is the thing. When do you do that action? Too soon and you cut off the TTS, too late and you're looking at blank screen too long.

Well, i'm only doing this when casting a camera with no mic or a dashboard. Basically, all you have to do is mute the speaker before casting and the sounds doesn't play. Then just unmute after and you're all set. Obviously wouldn't work for an audio file. But I'm using it with CATT when I want to send my dashboard to my Google home Hub.

1 Like

I see your point. I'm only using it on the mini right now, but I understand what you mean on the Home Hub. I do hope there's a solution there. Had given up on that one.

Cool. Thank you.

There is....but it only works about 95% of the time. So, I'm trying to figure out if there's a better way to do it.

1 Like