Announcement

Collapse
No announcement yet.

[BUG] Device String line break causes Hubitat's Echo Speaks app to crash *logs*

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

    [BUG] Device String line break causes Hubitat's Echo Speaks app to crash *logs*

    Michael McSharry -- hopfully this is an easy fix.

    I found out why I was having really inconsistent results on speaking text. Hubitat app was crashing (logs below). After 1.5 hrs of troubleshooting / trying everything, I determined my device string has a line break in it and when you send that to Hubitat... boom.

    I made notes on a few log lines. Took be a while since I set the Device String (to speak) using text pulled from another Homeseer device, which had a line break.

    Hubitat crashes and it seems to loop for a while trying to process it or something. Its dead until the system resets/stops erroring on its own (takes about 25 min) or you reboot the Hubitat.

    SpeakCommand = working proper
    speechCmd = bad

    Code:
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 05:10:50.922 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (Greg Unlocked) | Runtime: (4 sec) | QueueItems: (0)   ***  worked correctly; text puleld from device without line break
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 05:10:35.153 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (Greg Unlocked) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev13"]dev:13[/URL]2021-01-17 05:09:45.198 pm [URL="http://192.168.2.46/device/edit/13"]info[/URL] Socket (v3.3.1.1) | Alexa WS Connection is Open
    [URL="http://192.168.2.46/logs/past#dev13"]dev:13[/URL]2021-01-17 05:09:16.495 pm [URL="http://192.168.2.46/device/edit/13"]info[/URL]initialize() called
    [URL="http://192.168.2.46/logs/past#dev13"]dev:13[/URL]2021-01-17 05:06:48.837 pm [URL="http://192.168.2.46/device/edit/13"]warn[/URL] Socket (v3.3.1.1) | WebSocket connection closing.     *** rebooted Hubitat
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 05:06:45.743 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 05:06:41.703 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 05:06:37.681 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 05:06:33.637 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    ******GOES ON FOR A WHILE******
    ******GOES ON FOR A WHILE******
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:51:04.343 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:51:00.317 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:50:54.198 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:50:47.173 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:50:43.151 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:50:39.144 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null     *** crash : text sent from HS3 event
    
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:48:44.059 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (test) | Runtime: (4 sec) | QueueItems: (0)    ***  worked correctly; text entered manually & device Submit button clicked
    
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:46:52.121 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:46:48.085 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:46:44.034 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    ******GOES ON FOR A WHILE******
    ******GOES ON FOR A WHILE******
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:34:48.888 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:34:44.827 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:34:40.821 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null   *** crash : text sent from HS3 event
    
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:34:29.345 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (test) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:33:57.852 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (hello) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:26:23.237 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:26:19.184 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:26:15.113 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    ******GOES ON FOR A WHILE******
    ******GOES ON FOR A WHILE******​​​​​​​
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:17:48.738 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:17:42.572 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:17:38.587 pm [URL="http://192.168.2.46/device/edit/8"]error[/URL]Echo (v3.6.4.1) | speechCmd | Status: (400) | Message: Bad Request | Data: null
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:17:21.099 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (testing) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 04:01:52.181 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (take a shower smelly lady) | Runtime: (3 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 03:58:56.279 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (take a shower smelly lady) | Runtime: (3 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 03:58:49.970 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (take a shower smelly lady) | Runtime: (3 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 01:28:54.801 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (take a shower smelly lady) | Runtime: (3 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 01:26:45.475 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (lift that ***) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 01:25:52.667 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (nice job mom... so proud of you) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 01:25:34.525 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (good workout) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 01:24:56.629 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (hello) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#app4"]app:4[/URL]2021-01-17 11:24:45.226 am [URL="http://192.168.2.46/installedapp/configure/4"]info[/URL] EchoApp (v3.6.4.4) | wakeupServer Completed... | Process Time: (10697ms) | Source: (healthCheck)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 11:18:36.420 am [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (hello) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 11:18:25.885 am [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (hello) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 11:18:18.529 am [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (hello) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 11:17:55.589 am [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (hello) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-17 11:17:43.822 am [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (hello) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev13"]dev:13[/URL]2021-01-17 11:16:04.300 am [URL="http://192.168.2.46/device/edit/13"]info[/URL] Socket (v3.3.1.1) | Alexa WS Connection is Open
    [URL="http://192.168.2.46/logs/past#dev13"]dev:13[/URL]2021-01-17 11:15:41.699 am [URL="http://192.168.2.46/device/edit/13"]info[/URL]initialize() called
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-16 10:48:13.653 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (Hello) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-16 10:48:06.309 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (Hello) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-16 10:47:58.934 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (Hello) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-16 10:47:50.232 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (hi) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-16 10:47:40.815 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (hi) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-16 10:43:20.757 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (hello) | Runtime: (4 sec) | QueueItems: (0)
    [URL="http://192.168.2.46/logs/past#dev8"]dev:8[/URL]2021-01-16 10:42:33.849 pm [URL="http://192.168.2.46/device/edit/8"]info[/URL] Echo (v3.6.4.1) | SpeakCommand Sent | (hello) | Runtime: (4 sec) | QueueItems: (0)

    #2
    I can filter out the CR and LF in the plugin if you think that will help.

    Comment


      #3
      Originally posted by Michael McSharry View Post
      I can filter out the CR and LF in the plugin if you think that will help.
      Please. If you replace them with a space, it would stop the Hubitat plugin from crashing. I'm wondering if all escape code/characters will crash it. I didnt test others but it might be best to remove any non-standard characters?

      Comment


        #4
        See if the attached helps. Replaced CR, LF and TAB with space.

        Attached Files

        Comment


          #5
          I tested a ton of variations. Hubitat no longer crashes with your latest mods. Please see my below test results. Maybe there are some easy mods to remove some other characters causing it to not speak. Like... ? / # ,

          I will also open an issue with the Hubitat app now that we know what the issues are. thx for maintaining this -- ypur PI is the only reason I bought the Hubitat!

          No Audio spoken, but did not crash Hubitat...

          Code:
          testing?
          #3
          3 #
          1/18/2021
           Offline For 9 mins, 19 secs *** Note: space is the first character (see below on what worked for more)
          Offline For 9 mins, 19 secs *** Note: NO space is the first character
          0 m/s^2
          1260, E South Boulder Rd, Lafayette, Boulder County, Colorado, 80026, USA
          https://www.google.com/maps/search/?api=1&query=39.9867186,-105.0729787
          9 mins, 19 secs
          https://
          1260,
          1/18
          /12
          maps/search
          39.9867186,-105.0729787
          Boulder County, Colorado **Note: comma is a problem - see below
          ?api
          &query ******* This triggers an odd voice command for skills
          ?
          ?api
          Worked fine...
          Code:
          -105.0729787°
          8:53:23 AM
          9 mins
           Offline For                    *** Note: space is the first character - this worked but the larger version above did not
          www.google.com
          80026 USA **Note: NO comma
          Boulder County Colorado
          !
          https
          https:

          Comment


            #6
            I can remove all non-alpha and non-number characters as well as remove leading and trailing white space. Normally speech engines handle comma and period to provide a pause in the speech, but if Hubitat cannot handle it then should not be included.

            Comment


              #7
              Originally posted by Michael McSharry View Post
              I can remove all non-alpha and non-number characters as well as remove leading and trailing white space. Normally speech engines handle comma and period to provide a pause in the speech, but if Hubitat cannot handle it then should not be included.
              ! works but # ? and others seem not to

              Comment


                #8
                In the attached I have changed CR, LF, TAB to space and removed other non-alpha/non-numeric.
                Attached Files

                Comment


                  #9
                  A few quirks...

                  A) any non-alphanumberic (&, # , ?) on its own causes the PI to send status text from the 'volume' device in that room - and Echo Speaks speaks the volume number.
                  B) 1/18 becomes 118 instead of 1 18
                  C) 1/18/2021 becomes 1 million 180 2021
                  D) 39.9867186,-105.0729787 becomes one huge number

                  Also, can you exclude ! and the - sign from being removed? they worked fine previously

                  Comment


                    #10
                    Rather than iterating this can you provide the list of characters you want removed, those you want to converted to space and any other special case that should be processed?

                    Comment


                      #11
                      In the attached I have implemented the following. Edit the removables and replaceables strings as you find appropriate. The empty string response is now "nothing".

                      Code:
                      string Speakable(string sText)
                      {
                      // keep 0-9 A-Z, a-z  space and . ! - /
                      
                      string[] removables = new[] { "\"", "$", "%", "&","'", "(", ")", "*", "+", ",", "/", ":", ";", "<", ">", "?", "@", "[", "\\","]","^", "`", "{","|","}","~" };
                      string[] replaceables = new[] { "\n", "\r", "\t", "_"};
                      
                      string rxString = string.Join("|", removables.Select(s => Regex.Escape(s)));
                      string text = Regex.Replace(sText, rxString, string.Empty);
                      rxString = string.Join("|", replaceables.Select(s => Regex.Escape(s)));
                      text = Regex.Replace(text, rxString, " ");
                      
                      if (text == "") text = "nothing";
                      return text;
                      }

                      Comment


                        #12
                        Originally posted by Michael McSharry View Post
                        Rather than iterating this can you provide the list of characters you want removed, those you want to converted to space and any other special case that should be processed?
                        Sorry, it was necessary. Your first update fixed the crashing that didnt allow me to test the characters until after that stopped. I have not tested all non-alphas. I'll try to get time for that in the next few days.

                        based on my prior test comments...

                        A) any non-alphanumberic (&, # , ?) on its own causes the PI to send status text from the 'volume' device in that room - and Echo Speaks speaks the volume number.
                        ...I dont know how to fix this, or what causes it. I suspect I'll need to test more after we update for the below items.

                        B) 1/18 becomes 118 instead of 1 18
                        C) 1/18/2021 becomes 1 million 180 2021
                        ... Looks like the 'slash' should be replaced with 'space'

                        D) 39.9867186,-105.0729787 becomes one huge number
                        ... Looks like the 'comma' should be replaced with 'space'

                        Also, can you exclude ! and the - sign from being removed? they worked fine previously

                        Comment


                          #13
                          The ! and - are not in either of the two lists so they are left alone. The slash can be moved to the replaceable list.

                          Comment


                            #14
                            I did the / to space in (13). I see I forgot to post the other (12). They are attached here.
                            Attached Files

                            Comment


                              #15
                              Tested...

                              not working...

                              @ * , $ % ^ & ? + | " ; : { } [ ] .. by themselves, they all make it speak the word "nothing". Wondering if you leave them (not remove them) add a space before and after, if it will speak the name of the character, like the ones below? I think that might be best - instead of removing them?

                              # no speaking
                              / no speaking

                              working...

                              = "equals"
                              ! "exclamation mark"
                              - "dash"
                              . "dot"
                              &query "query" (no longer triggers an odd voice command for skills)
                              https:// "https"
                              1/18/2021 "1 18 2021"

                              Comment

                              Working...
                              X