I am trying to create an event (scripted) that when my wife turns on her music in the bathroom in the morning it first plays the weather for her. It's randomly working though. Seems that sometimes the script waits for the speech to finish before moving forward, and other times it just plain runs thru it, ignoring the delay I have in there.
I am using this from the doc to create the delay. Am I using it wrong?
I am using this from the doc to create the delay. Am I using it wrong?
Code:
hs.PluginFunction("BLSpeech", "", "ContinueAfterSpeaking", Nothing)
Code:
Sub Main (Parms as Object) Try dim House_Mode as String = hs.devicestring(1060) Dim Weather as string = hs.devicestring(756) dim playerInstance as string dim Args(1) as object playerInstance = "Player_b827ebb275f9" Args(0) = "pandora playlist play item_id:6799a2a7.0.0" Args(1) = False hs.PluginFunction("BLRussound", "", "SetZonePower", New Object(){1,5,"On"}) System.Threading.Thread.CurrentThread.Sleep(1000) If House_Mode = "Sleep" OrElse House_Mode = "Dawn" OrElse House_Mode = "Morning" then hs.speak ("{speaker=Bathroom,volume=28, source=2} " & Weather, True) hs.PluginFunction("BLSpeech", "", "ContinueAfterSpeaking", Nothing) Else hs.speak ("{speaker=Bathroom,volume=40, source=2} " & Weather, True) hs.PluginFunction("BLSpeech", "", "ContinueAfterSpeaking", Nothing) End If hs.PluginFunction("BLRussound", "", "SetZoneSource", New Object(){1,5,5}) hs.PluginFunction("SqueezeBox", playerInstance, "PlayerSendCLICommand", Args) Catch ex As Exception hs.WriteLog("Pandora Weather Script", "Exception " & ex.ToString) End Try End Sub
Comment