How to do announcements with Airfoil Pro and Google Homes

Posted on
Fri Jan 12, 2018 10:57 am
Juggler offline
Posts: 95
Joined: Dec 17, 2014

How to do announcements with Airfoil Pro and Google Homes

Running the latest version of Indigo and Airfoil on OS X 10.11.6. I have several Google Home Minis through my house and would like to be able to send announcements (indigo.server.speak("text to speak", waitUntilDone=True).

I'm struggling with how to code this in python. I've tried the following:
Code: Select all
airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.airfoilpro")

if airfoilPlugin.isEnabled():
    try:
        result = airfoilPlugin.executeAction("connect", deviceId=SPEAKERID, waitUntilDone=True)
        indigo.server.speak("text to speak", waitUntilDone=True)
        result = airfoilPlugin.executeAction("disconnect", deviceId= SPEAKERID, waitUntilDone=True)

    except Exception, e:
        print "Exception occurred: %s" % unicode(e)

However the above code only seems to connect to the speaker, then disconnect. I do not hear any announcement. I'm sure I'm missing something basic here...

Posted on
Fri Jan 12, 2018 12:05 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to do announcements with Airfoil Pro and Google Home

Is Airfoil directing your Mac's speech to the speaker?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jan 12, 2018 12:17 pm
Juggler offline
Posts: 95
Joined: Dec 17, 2014

Re: How to do announcements with Airfoil Pro and Google Home

Using the terminal on my Mac, I can get the Google Home to speak with the CLI (say "hello"). To do this, I have to have the source set to com.apple.speech.speechsynthesisd and pre-select the correct Google Home in the light blue list of speakers.

I did see in Airfoil's preferences there is an "Automatically Transmit To" tab. I've tried to use this, but nothing worked.

Posted on
Fri Jan 12, 2018 12:23 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: How to do announcements with Airfoil Pro and Google Home

What is Airfoil's speaker setting? Where's it getting it's audio?
Attachments
Screen Shot 2018-01-12 at 11.21.36 AM.png
Screen Shot 2018-01-12 at 11.21.36 AM.png (32.22 KiB) Viewed 6320 times

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Fri Jan 12, 2018 12:34 pm
Juggler offline
Posts: 95
Joined: Dec 17, 2014

Re: How to do announcements with Airfoil Pro and Google Home

This is how I have it set.
Attachments
preferences.png
preferences.png (71.9 KiB) Viewed 6317 times
source.jpg
source.jpg (53.38 KiB) Viewed 6317 times

Posted on
Fri Jan 12, 2018 3:59 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to do announcements with Airfoil Pro and Google Home

I don't have any Google Home devices, but all my AirPlay devices are working correctly. I have System Audio selected, and I can direct all sound (including Indigo speech) to any AirPlay destination.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jan 12, 2018 4:03 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to do announcements with Airfoil Pro and Google Home

Are you running the Indigo Client and Server on the same Mac?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jan 12, 2018 7:06 pm
Juggler offline
Posts: 95
Joined: Dec 17, 2014

Re: How to do announcements with Airfoil Pro and Google Home

No... running Indigo on a headless Mac in my basement. Will have to play more. Wonder if there is something particular to Google Homes?

Posted on
Fri Jan 12, 2018 10:29 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: How to do announcements with Airfoil Pro and Google Home

No, I don’t think it is Google Home because I tried your code myself out of curiosity and it’s the same result to an AirPlay device.

So I then set up an action group that did the same thing and got almost the same result. My test was to say “test speech” and it got “t” out (maybe it was “ch”) but I got a tiny bit of speech.

This led me to try a really long phrase “the brown cow jumped over the big white fence” and got “umped over the big white fence” with the action group but the same phrase in the Py code got nothing at all.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Sat Jan 13, 2018 1:19 pm
Juggler offline
Posts: 95
Joined: Dec 17, 2014

Re: How to do announcements with Airfoil Pro and Google Home

Looks like it may be a timing problem. The following code works for me:
Code: Select all
import time
airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.airfoilpro")

if airfoilPlugin.isEnabled():
    try:
        result = airfoilPlugin.executeAction("connect", deviceId=1419104389, waitUntilDone=True)  # ID of Speaker device
        time.sleep(10)
        indigo.server.speak("text to speak", waitUntilDone=False)
    except Exception, e:
        print "Exception occurred: %s" % unicode(e)

I've then got Airfoil to auto-disconnect from speakers after 1m of silence.

Posted on
Sat Jan 13, 2018 3:38 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: How to do announcements with Airfoil Pro and Google Home

Yea, that was going to be my next step if I hadn't been working on other plugin stuff today, I assumed it was timing based on my test results. The timing of calling it from code is more than the timing of calling it from the native UI apparently.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Sat Jan 13, 2018 7:12 pm
Juggler offline
Posts: 95
Joined: Dec 17, 2014

Re: How to do announcements with Airfoil Pro and Google Home

It's too bad about the 10s timing issue... there is a way with a Google Home that allows you to broadcast a message to all of the ones connected to your account. Unfortunately, this would require Oauth. I remember reading in a thread somewhere that Matt & Jay were looking into adding an Oauth server? +1 for that. (would also allow me to start using my GH for device control).

Posted on
Sun Jan 14, 2018 4:44 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to do announcements with Airfoil Pro and Google Home

So, it's taking 10 seconds for Airfoil to connect to the Google Home? That seems excessive. I just tested it and it connects to my AirPlay devices in < 3secs...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Jan 14, 2018 5:24 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: How to do announcements with Airfoil Pro and Google Home

jay (support) wrote:
I just tested it and it connects to my AirPlay devices in < 3secs...


So does mine about 80% of the time, but - and perhaps this is the result of other processes on the computer running Indigo - it can take 5+ seconds. This has been on my todo list to add to one of my plugins for a while so I just rolled it into on to see if running as a plugin thread made any difference and it's about the same performance.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Mon Jan 22, 2018 12:27 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to do announcements with Airfoil Pro and Google Home

My guess is that it's somewhat network intensive and so connection times can vary given the amount of other things that the device being AirPlayed to is doing and what other network traffic is going on.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest