Announcement

Collapse
No announcement yet.

TTS Speak Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    TTS Speak Script

    I don't know if this is of use for anyone. My programming skills are very limited, but I couldn't find any other way to do it (Happy for someone to point me at an easier way).

    I wanted IFTTT to be able to speak via TTS. So, for example when an Office 365 reminder triggered IFTTT, I wanted Homeseer to announce it. There didn't seem to be any way to get the Homeseer IFTTT applet to do it, so I used the voice command and a script.

    Here's what I did. In IFTTT, setup your trigger what ever that may be. Then in the action section, select homeseer and use the "Send a text command to Homeseer" action. Delete anything in the text box that comes at the next screen.

    Anything you wan to speak needs to have Speak prepended before it. So if you wanted to speak This is a test you would write Speak This is a test.

    It will also work with ingredients, such as the Office 365 ingredient I use, which is: Speak Reminder. {{Subject}} starts in 15 minutes.

    Once you have your trigger and action together, you need to create check_vcmd.vb in the Homeseer\scripts directory. Then past the following..

    Code:
    Function Main(parm as object)
    Dim strCheck
    Dim strText
    Dim strLength 
    
    hs.writelog("VCMD","Starting")
    hs.writelog("VCMD","Phrase: " & parm)
    strCheck = Left(parm, 5)
    If strCheck = "Speak" Then
    	strLength = parm.Length - 6
    	strText = parm.Substring(6, strLength)
    	'hs.writelog("VCMD","TTS: " & strText)
    	Do While hs.isspeakerbusy = True
    		hs.writelog("VCMD","Speaker Busy, Waiting")
    		hs.waitsecs(5)
    	Loop
    	'hs.mediaplay("media\Announcement.wav",)
    	hs.waitsecs(2)
    	hs.speak(strText)
    End If
    return ""
    End Function
    If you want to use a presound before the speech, uncomment the hs.mediaplay line and change it to match the wav you want to play.

    As this script doesn't process any actual commands other than using TTS, it returns null to homeseer that should then continue to process any actual voice commands.

    Hope it helps someone. Or, maybe someone can point me to a better way of doing it

    <edit> Oh, and thanks to Rich in this thread: https://forums.homeseer.com/showpost...0&postcount=24 for the original VR scripts basics.
Working...
X