Announcement

Collapse
No announcement yet.

Help with delays when HS speaks!!

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

    Help with delays when HS speaks!!

    I have always noticed this but have just never posted anything about it. It is now starting to bug me because I do not feel it should act like this. Here is what happens:

    It appears that when HS is speaking, that when I go into a room that has a motion sensor that turns on a light, there is a delay in the light turning on until after HS has finished speaking.

    For example, I have a good morning event that runs and speaks the date, house reminders, tv reminders, emails, weather, school bus status, etc. It appears that no other events (like a motion sensor turning on a light when I walk into a room while the announcements are happening work until after the speaking is complete.

    Has anyone else noticed this.

    I am running HS 1.7, but it has happened all along in other releases. When I use the hs.speak or system.speak commands I am using a TRUE on the end. I have also coded hs.waitEvents in the scripts as well, but it still is delaying.

    I am at a loss here.
    Cheers,
    Bob
    Web site | Help Desk | Feature Requests | Message Board

    #2
    The TRUE is what's doing it. TRUE at the end says to wait until speaking is finished before continuing. If you specify TRUE then HS runs the TTS in it's own thread and nothing else can happen. If you specify FALSE then the speech is spawned in it's own thread and HS can continue to do stuff.

    George

    Comment


      #3
      Thanks George. I will give it a try
      Cheers,
      Bob
      Web site | Help Desk | Feature Requests | Message Board

      Comment


        #4
        George,

        I changed my hs.speak commands to use FALSE instead of TRUE and it still waited until the speaking was done in order to turn my lights on after motion was detected, even tho I tripped the motion sensor while it was speaking.

        I am getting very frustrated
        Cheers,
        Bob
        Web site | Help Desk | Feature Requests | Message Board

        Comment


          #5
          Bob,
          Instead of false do not put anything at the end of the hs.speak line. This is an optional argument and thus needs to be left off if not using true.
          💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

          Comment


            #6
            could i see your good morning script your using? sounds like i would use it.
            please
            FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

            HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

            Comment


              #7
              Here is the script. You will have to modify it for you own uses. Enjoy

              I have it run off of my Kitchen motion sensor

              '*********************************************************** *******************************
              ' This announces good morning messages
              '*********************************************************** *******************************
              Sub Announce_Good_Morning_Messages(override)

              goodMorningCompleted = hs.DeviceStringByName("Home Good Morning Announcement Completed")

              if goodMorningCompleted = "No" OR override = "Yes" then

              dim code

              gmCount = hs.DeviceStringByName("Home Good Morning Announcement Count")

              gmCount = gmCount + 1

              ' increment good morning count by 1
              code = hs.GetDeviceCode("Home Good Morning Announcement Count")
              hs.SetDeviceStringByName "Home Good Morning Announcement Count", gmCount
              hs.SetDeviceLastChange code, now

              if gmCount < MAX_GOOD_MORNINGS then
              ' set good morning announcement completed to Yes (temporarily)
              code = hs.GetDeviceCode("Home Good Morning Announcement Completed")
              hs.SetDeviceStringByName "Home Good Morning Announcement Completed", "Yes"
              hs.SetDeviceLastChange code, now

              'set event so that it will not run another good morning for at least certain number of minutes
              dm.NewNoMotionDelayedEvent "Enable Another Good Morning Announcement", "", NEXT_GOOD_MORNING_DELAY, "Home_Actions.txt(""Enable_Another_Good_Morning_Announcement "")"
              end if

              if gmCount >= MAX_GOOD_MORNINGS then
              ' set good morning announcement completed to Yes
              code = hs.GetDeviceCode("Home Good Morning Announcement Completed")
              hs.SetDeviceStringByName "Home Good Morning Announcement Completed", "Yes"
              hs.SetDeviceLastChange code, now
              end if

              timeOfDay = ""
              ntime = TimeValue(now)

              if ntime >= TimeValue("12:00 am") AND ntime <= TimeValue("11:59 am") then
              timeOfDay = "morning"
              hs.waitEvents
              hs.Speak "Good morning!", FALSE
              hs.waitSecs 2
              elseif ntime >= TimeValue("12:00 pm") AND ntime <= TimeValue("4:59 pm") then
              timeOfDay = "afternoon"
              hs.waitEvents
              hs.Speak "Good afternoon!", FALSE
              hs.waitSecs 2
              elseif ntime >= TimeValue("5:00 pm") AND ntime <= TimeValue("11:59 pm") then
              timeOfDay = "evening"
              hs.waitEvents
              hs.Speak "Good evening!", FALSE
              hs.waitSecs 2
              end if

              ' announce current date
              currentDate = formatDateTime(Date, 1)
              hs.Speak "Today is " & currentDate & ".", FALSE

              ' get house reminders
              reminderAnnouncement = hs.DeviceStringByName("Home Current Reminders")

              ' get tv reminders
              tvReminderAnnouncement = hs.DeviceStringByName("Home TV Reminders")

              ' Announce school bus status
              currentWeekDay = Weekday(CDate(Date))
              if currentWeekDay <> 1 AND currentWeekDay <> 7 AND _
              timeOfDay = "morning" AND ntime <= TimeValue("8:20 am") then ' not a Saturday or Sunday
              hs.waitEvents
              hs.Run "School_Bus_Status_Manual.txt"
              end if

              ' Announce house reminders for the day
              hs.waitEvents
              hs.Speak reminderAnnouncement, FALSE

              ' Announce tv reminders for the day
              hs.waitEvents
              hs.Speak tvReminderAnnouncement, FALSE

              ' Announce furnace filter change reminder (if there is a reminder)
              filterChangeReminder = hs.DeviceStringByName("Home Furnace Filter Change Reminder")

              if filterChangeReminder <> "None" then
              hs.waitEvents
              hs.Speak filterChangeReminder, FALSE
              end if

              ' Announce new email messages (if any) for Bob and Trista
              emailCount = CInt(hs.DeviceStringByName("Home New Email Messages (BobTrista)"))

              if emailCount > 0 then
              hs.waitEvents
              if emailCount = 1 then
              hs.Speak "Bob has " & emailCount & " new email message.", FALSE
              else
              hs.Speak "Bob has " & emailCount & " new email messages.", FALSE
              end if
              end if

              ' Announce new email messages (if any) for Trista
              emailCount = CInt(hs.DeviceStringByName("Home New Email Messages (Trista)"))

              if emailCount > 0 then
              hs.waitEvents
              if emailCount = 1 then
              hs.Speak "Trista has " & emailCount & " new email message.", FALSE
              else
              hs.Speak "Trista has " & emailCount & " new email messages.", FALSE
              end if
              end if

              ' Announce new email messages (if any) for Courtney
              emailCount = CInt(hs.DeviceStringByName("Home New Email Messages (Courtney)"))

              if emailCount > 0 then
              hs.waitEvents
              if emailCount = 1 then
              hs.Speak "Courtney has " & emailCount & " new email message.", FALSE
              else
              hs.Speak "Courtney has " & emailCount & " new email messages.", FALSE
              end if
              end if

              ' Announce new email messages (if any) for Brittney
              emailCount = CInt(hs.DeviceStringByName("Home New Email Messages (Brittney)"))

              if emailCount > 0 then
              hs.waitEvents
              if emailCount = 1 then
              hs.Speak "Brittney has " & emailCount & " new email message.", FALSE
              else
              hs.Speak "Brittney has " & emailCount & " new email messages.", FALSE
              end if
              end if

              ' Announce new email messages (if any) for Hunter
              emailCount = CInt(hs.DeviceStringByName("Home New Email Messages (Hunter)"))

              if emailCount > 0 then
              hs.waitEvents
              if emailCount = 1 then
              hs.Speak "Hunter has " & emailCount & " new email message.", FALSE
              else
              hs.Speak "Hunter has " & emailCount & " new email messages.", FALSE
              end if
              end if

              ' Announce current weather
              hs.waitEvents
              hs.Run "London_Weather_Short.txt"

              end if

              End Sub
              Cheers,
              Bob
              Web site | Help Desk | Feature Requests | Message Board

              Comment


                #8
                Well, I removed the FALSE from the hs.speak commands, but it still waits until the speaking is done before turning on the light that I triggered with the motion sensor while it was talking. It is like HS is defaulted to wait for the speaking to finish.

                Now I am confused. All motion sensors are waiting until the speaking is done and then all the lights that were triggered when it was speaking, come on right after speaking is done.

                Can anyone help?
                Cheers,
                Bob
                Web site | Help Desk | Feature Requests | Message Board

                Comment


                  #9
                  That script does a lot of speaking.

                  Somebody please correct me if I'm wrong, but this is my understanding of hs.Speak()

                  If the last parameter is FALSE, HomeSeer passes the phrases to be spoken to SAPI, and returns directly to executing the script. But if you call hs.Speak again, it has to wait for the previous speech to finish before it can pass the new phrases to SAPI. So hs.Speak stalls the script despite having FALSE as the last parameter.

                  I think this means that HomeSeer cannot turn on the light until your second-to-last hs.Speak call has finished speaking.

                  Comment


                    #10
                    Soooo would combining all the hs.speaks into one giant hs.speak solve the problem? Try concatenate all of the text strings together and speak them as one sentences at the bottom of the script.
                    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                    Comment


                      #11
                      I use system.speak everywhere and have no problems. That way scripts work over the phone also. Just a thought...


                      ~Bill

                      Comment


                        #12
                        I would like to hear from Rich or Rick on this problem.

                        Rich/Rick?
                        Cheers,
                        Bob
                        Web site | Help Desk | Feature Requests | Message Board

                        Comment


                          #13
                          Bob,

                          If you still have a speak proxy plug-in installed, such as IsSpeaking or SpeakEasy, then the delay may be there instead of with HomeSeer. Also, the operation of the parameter at the end deals with handing off the speak operation to SAPI, but it cannot know how your sound board interacts with SAPI. In other words, with some sound boards SAPI will be told that it is done speaking even though it is not done, and with others it will not indicate that it has even accepted the text until it is done speaking.

                          The IsSpeaking plug-in is what I have used for the past year and a half. If you put the script command in that disables the speak proxy functionality, then it will operate in the same mode as I have used it in for the past year in a half. In that mode, the script command continueafterspeaking has always worked to suspend a script until speaking was done for certain.

                          In your case, since you are trying to get a return right away, it might be a sound card issue or who knows, perhaps it is a bug, but I have not had any other reports of this lately.

                          If you are doing this with a script, then all bets are off without seeing the script, but using event actions means that device actions take place prior to speaking actions, so by default the device should go on before the text is spoken.
                          Regards,

                          Rick Tinker (a.k.a. "Tink")

                          Comment


                            #14
                            Rick,

                            I do not have isSpeaking or SpeakEasy installed right now. I removed the IsSpeaking plugin because of the problem I was having.

                            I should also mention that I am using the NeoSpeech voices.

                            I am also using a SoundMax integrated sound board.

                            The script I am using is posted above in this thread.

                            The script is currently triggered off of CAC code on my Kitchen motion sensor. It is not called from an event. Are you saying that if I called it from an event, the devices triggered by motion would come on quicker?

                            If I have to change the script to make it better than I will. It does take a couple of minutes to speak the good morning messages, but if someone triggers a motion sensor during the time it is speaking the messages, I want the light associated to the motion sensor to come on right away.

                            Please let me know the best way to proceed on this.

                            I appreciate it
                            Cheers,
                            Bob
                            Web site | Help Desk | Feature Requests | Message Board

                            Comment


                              #15
                              Blade,

                              I would definitely concatenate the speaking phrases as Rupp suggested and speak only at the end of the script. This should also allow you to get rid of some of the hs.WaitEvent calls.

                              For effect, you may want to add a comma between each phrase so that the speaking will pause (but script will not). Look into using the CreateStringClass function which does fast string concatenation.

                              I would skip the if emailcount=1 then portions and just before speaking the concatenated phrase do something like:

                              <pre class="ip-ubbcode-code-pre">
                              sPhrase = Replace(sPhrase, "1 new email messages", "1 new email message)
                              </pre>

                              which will fix the formatting all in one shot.

                              I would also consider altering your London_Weather_Short.txt script to return the phrase and the you could use:
                              <pre class="ip-ubbcode-code-pre">
                              sPhrase = sPhrase & hs.RunEx("London_Weather_Short.txt","GetWeatherPhrase","")
                              </pre>
                              or, if you are using the CreateStringClass:
                              <pre class="ip-ubbcode-code-pre">
                              ...
                              FastCat.Add ", "
                              FastCat.Add hs.RunEx("London_Weather_Short.txt","GetWeatherPhrase","")
                              hs.Speak FastCat.Value
                              </pre>
                              Jim Doolittle

                              My Twitter
                              My Hardware & Software

                              Comment

                              Working...
                              X