Announcement

Collapse
No announcement yet.

JSON speak action with SONOS plugin

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

    JSON speak action with SONOS plugin

    I'm trying to use the JSON API speak action to route a TTS message via the SONOS plugin. I'm specifying the HOST parameter based on the way that SONOS audio devices are referred to within TTS events (
    Code:
    $SONOS$GROUPNAME$:DEVICENUM
    , for example
    Code:
    $SONOS$MASTER$:102
    ). When I do this, I'm getting a "That device was not found." announcement via TTS rather than the text passed in via the phrase parameter. Is there any more detailed documentation on what values are acceptable via the HOST parameter with the speak action?

    #2
    I've tried it and it looked like it didn't work to start with then does now...not sure why, I did try URL encoding the device but now I've taken that out and it still works OK.

    Are you sure your SONOS host name is correct? Mine is $SONOS$Group$InterceptDevice:*

    By the looks of it you are not giving it the InterceptDevice parameter (and not sure what the devicenum refers to?)...I never really played a huge amount with it but I've tested it here in Postman and I can get the JSON command to work.

    Code:
    http://192.168.1.35/JSON?request=speak&phrase=testing123&host=$SONOS$AllHouseGroup$DEFAULT:*

    Comment


      #3
      Via Postman, this request

      Code:
      http://192.168.33.99/JSON?request=speak&phrase=testing&HOST=$SONOS$LIVING$DEFAULT$:*
      gives me an announcement on the speakers associated with the "LIVING" (living room) linkgroup stating "That device was not found"

      The equivalent event shown below works perfectly. I don't understand where I'm going wrong.

      Click image for larger version

Name:	Capture.PNG
Views:	359
Size:	179.9 KB
ID:	1394065

      Comment


        #4
        Originally posted by mealiffe View Post
        Via Postman, this request

        Code:
        http://192.168.33.99/JSON?request=speak&phrase=testing&HOST=$SONOS$LIVING$DEFAULT$:*
        gives me an announcement on the speakers associated with the "LIVING" (living room) linkgroup stating "That device was not found"

        The equivalent event shown below works perfectly. I don't understand where I'm going wrong.

        Click image for larger version  Name:	Capture.PNG Views:	0 Size:	179.9 KB ID:	1394065
        set plugin debug flag to "errors and events", send in your JSON command, post log here or in Sonos forum
        Please add screenshots and enough info so I know exactly what you did.

        Comment


          #5
          Ok, here's what I'm sending with postman:

          Click image for larger version

Name:	Capture2.PNG
Views:	187
Size:	225.2 KB
ID:	1394083

          Debug log from sonos plugin attached.

          Given this line from the logfile, it seems like the sonos plugin is getting the "That device was not found." text from elsewhere?

          Code:
          6/15/2020 3:36:14 PM : SpeakIn called for Device = 0, Text = That device was not found., Wait=False, Host = $SONOS$LIVING$DEFAULT$:*, PIInitialized = True

          Comment


            #6
            Originally posted by mealiffe View Post
            Ok, here's what I'm sending with postman:

            Click image for larger version

Name:	Capture2.PNG
Views:	187
Size:	225.2 KB
ID:	1394083

            Debug log from sonos plugin attached.

            Given this line from the logfile, it seems like the sonos plugin is getting the "That device was not found." text from elsewhere?

            Code:
            6/15/2020 3:36:14 PM : SpeakIn called for Device = 0, Text = That device was not found., Wait=False, Host = $SONOS$LIVING$DEFAULT$:*, PIInitialized = True
            You are right, HS somewhere changes the text to, what I would guess, is an error.

            Should the $SONOS$LIVING$DEFAULT$:* be escaped in the URL? This would be a question to ask the HS team rjh how this can be traced.

            The host name is obviously not known in the HS system, I wonder whether that is the root to the issue here, assuming they have some internal check to translate hostname into an active speaker client, which is not the case here. Having that said, they do seem to call the proxy function so something strange is going on.

            Comment


              #7
              I can get it to work using curl command

              Code:
              curl '192.168.1.103/JSON?request=speak&phrase=testing&host=$SONOS$LVR$:'
              Can't figure out how your supposed to insert spaces though. For phrase "testing%20123", it says "The testing is now one hundred and twenty three" ...

              Nothing to do with Sonos, same when using speaker client.

              Comment


                #8
                Never got a reply from hst for this . This was present in hs3 too



                https://forums.homeseer.com/forum/hs...n-api-is-buggy


                Comment


                  #9
                  Originally posted by MattL0 View Post
                  Never got a reply from hst for this . This was present in hs3 too



                  https://forums.homeseer.com/forum/hs...n-api-is-buggy

                  Whoa. Ok, so this API seems buggy and not well supported. Guess I'll look at other alternatives unless somebody from HS can help out? rjh ?

                  Comment


                    #10
                    In case anyone would still like to speak via HS3 and the /JSON?request=speak&phrase= URL using text that contains spaces, I found that replacing all spaces with dashes allows the text to be read normally, as entered. When there are spaces or '%20' (which is a URL-encoded space), it speaks the phrase as if the first words collectively form the name of a device and the last word is a value, "
                    Code:
                    http://<your_local_hs_ip_address>/JSON?request=speak&phrase=I believe so, yes, thank you randy
                    This is spoken as, "The I believe so, yes, thank you is now randy"

                    Code:
                    http://<your_local_hs_ip_address>/JSON?request=speak&phrase=I-believe-so,yes,thank-you-randy
                    This will speak the phrase correctly using the default voice in the HomeSeer Speaker app. I bought the Ivona 'Brian' voice a long time ago and still use it today.

                    I am also able to add on which speaker client to speak out of. I don't have any Sonos speakers, so I can't try that aspect of the OP, but I can use other speaker clients.

                    Related: I recently started using Jon00's Voice Monkey ASPX script to trigger my Echo Dot to ask a question and wait for a yes/no answer. You can create a different Voice Monkey (appears in Alexa as a named Smart Home doorbell press) for different Alexa devices. A feature in Jon00's unmanaged plugin (meaning it's a plugin that connects to HS that you install from outside of Homeseer and not using the HS plugin repository) is that you can use any of the Voice Monkeys as speaker clients and then configure them to use different voices. I setup, ALEXA:ECHODOT & ALEXA:IPHONE speaker clients (they never appear in the HS Network settings tab) to speak out of my Echo Dot & iPhone (well, when the Alexa app is running on my iPhone) using the same Brian voice I bought years ago. It's not using the actual voice that I bought or any voice from my computer, it just happens to also have the same voice available. So no matter where I send text to be read, it's all read in the same voice and everything appears as if it's one announcement system. For fun, I also setup ALEXA:ECHOWHISPER & ALEXA:IPHONEWHISPER clients so I can have the Alexa devices whisper. This aspect of the Voice Monkey skill (changing its voice based on SSML tags) is buggy, however, as it sometimes speaks in its regular full voice which is startling to say the least when you expect whispering responses in the middle of the night!

                    Without getting too deep into Voice Monkey specifics here (you can search the HS forum for detailed posts about how to use Jon00's script & Voice Monkey itself), I have a Voice Monkey created at the voicemonkey.io website named, 'speak-echo-dot' and use that in Jon00's Voice Monkey page to create a HomeSeer virtual speaker client like this:
                    Click image for larger version  Name:	Screen Shot 2022-07-11 at 5.04.29 PM.png Views:	0 Size:	48.5 KB ID:	1556263

                    Code:
                    http://<your_local_hs_ip_address>/JSON?request=speak&phrase=say-something-for-me&host=ALEXA:ECHODOT
                    This speaks, "say something for me" out of my Echo Dot (after a delay of about 3.5 seconds) in the Brian voice.

                    Comment


                      #11
                      Did this break in the current HS4 Windows version 4.2.16.0 ? I noticed my events were speaking across my hosts a couple of weeks ago but now I get "That Device Not Found" on all of them.

                      Anybody else see the same issue?

                      *Disregard...A PC reboot fixed my issue

                      Comment

                      Working...
                      X