Announcement

Collapse
No announcement yet.

How do I make my Echo speak when devices change? - TTS is configured!

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

    How do I make my Echo speak when devices change? - TTS is configured!

    I installed Node Red a Pi and have already configured it to speak through my Alexa clients. Works fine. Now... how do I make this happen based on device changes? here's what I have so far:

    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    #2
    I'd look at the device in HS that triggers an event. The event then sends the text to Node-red as a string via a virtual device.

    Comment


      #3
      Put a change node in between the HS device and the "routine speak" and set the text for the phrase you want spoken based on the status of the HS device. I'm not at home right now but I can post the flow a little later today.
      "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

      Comment


        #4
        If you are using the Alexa-Remote2 contrib, you set a couple items in the payload and then add then to an Alexa Routine, OR you can just set them in the Routine node.

        Here is how the change node will look. This sets msg.payload.text to what you wish to be spoken. In this example it will output to an Alexa device called "Karl's Alexa App". You can add others by name by separating them with commas. So this will speak over 2 units: ["Karl's Alexa App","Office Flex"]. Note that it doe sNOT work with the Alexa phone app and may not work with non-Amazon deices :
        Click image for larger version

Name:	hs3.png
Views:	523
Size:	26.4 KB
ID:	1432789


        The Alexa Routine needs to be set like this. This is an example from a different thread where we first saved the output from an Alexa Event node to msg.alexaPayload as a later HomeSeer device node overwrites msg.payload. In this case we use the same device which heard the voice request to speak and we send it the text as set above:
        Click image for larger version

Name:	hs4.png
Views:	492
Size:	18.5 KB
ID:	1432790


        You COULD do without the Change node and wire the HomeSeer node directly to the Alexa routine node. Then you just set the routine node as shown, but change the Text setting to any variable passed or a hard coded message like below, and set the Devices as required. Here I set it to the Office device which is populated in a pick list. I got that from the icon to the right of the Devices field:
        Click image for larger version

Name:	hs5.png
Views:	507
Size:	20.3 KB
ID:	1432791
        Attached Files
        Karl S
        HS4Pro on Windows 10
        1070 Devices
        56 Z-Wave Nodes
        104 Events
        HSTouch Clients: 3 Android, 1 iOS
        Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

        Comment


          #5
          ksum Thanks! i'll go through your example and will try that.
          💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

          Comment


            #6
            Originally posted by kenm View Post
            Put a change node in between the HS device and the "routine speak" and set the text for the phrase you want spoken based on the status of the HS device. I'm not at home right now but I can post the flow a little later today.
            how difficult would it be to create a sequence that would speak "Garage door is open" and "Garage door is closed". What would be the steps? remember, I am NOT a programmer!
            💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

            Comment


              #7
              Use a Change node wired between the HomeSeer device node and the Alexa routine node. Set it as shown below. msg.payload.text is set to an Expression with the field containing:
              Code:
              "The garage door is " & msg.payload.status
              Click image for larger version

Name:	hs3.png
Views:	581
Size:	19.2 KB
ID:	1432811

              Or just Import this, which is the change node above, and wire it in between your above nodes:
              Code:
              [{"id":"41578e29.ca7c3","type":"change","z":"2b720ce0.8b6e94","name":"","rules":[{"t":"set","p":"payload.text","pt":"msg","to":"\"The garage door is \" & msg.payload.status","tot":"jsonata"},{"t":"set","p":"type","pt":"msg","to":"speak","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1160,"y":280,"wires":[["638f8300.808d7c"]]}]
              To import that node, copy that code to your clipboard, use the "hamburger" menu in the top right of the node red browser and select Import. Then paste the code and ake sure the Import window is set in the bottom left to import it into the current flow.

              Set your Alexa routine node as shown below, using your settings for the Account and Devices fields:
              Click image for larger version

Name:	hs4.png
Views:	492
Size:	18.7 KB
ID:	1432812
              Karl S
              HS4Pro on Windows 10
              1070 Devices
              56 Z-Wave Nodes
              104 Events
              HSTouch Clients: 3 Android, 1 iOS
              Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

              Comment


                #8
                Thanks for reposting with the details Karl!
                💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                Comment


                  #9
                  You are welcome! When you are tired of it spouting off all the time, post some details on what limits you may want to place on the announcement, or other improvements. If your place is like mine it will go off way too much on weekends. Especially when working outside. My wife closes the door because I walked around to the shed to get a tool. I get back to the garage and have to open it again.
                  Karl S
                  HS4Pro on Windows 10
                  1070 Devices
                  56 Z-Wave Nodes
                  104 Events
                  HSTouch Clients: 3 Android, 1 iOS
                  Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

                  Comment


                    #10
                    OK, I'm tweaking it now. This all works just fine but I have the nagging suspicion I don't need all of these change nodes... that I might be able to replace the hard-coded strings like "The Garage Door is" with a variable that uses the device name. Is that possible? I tried msg.payload.name (as a guess) but that didn't work.
                    Attached Files
                    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                    Comment


                      #11
                      Correct. Since you have those names and status settings one Change node will do. Change the spoken text in one of them so that msg.payload.text is set to:
                      Code:
                      "The " & msg.payload.name & " is " & msg.payload.status
                      All I did was replaced kitchen door in your image to " & msg.payload.name & " to get the HomeSeer Device's Name to be spoken for the item in question. Then you can wire all the HomeSeer outputs to the one Change node you edited and remove all the rest.
                      Karl S
                      HS4Pro on Windows 10
                      1070 Devices
                      56 Z-Wave Nodes
                      104 Events
                      HSTouch Clients: 3 Android, 1 iOS
                      Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

                      Comment


                        #12
                        Originally posted by ksum View Post
                        Correct. Since you have those names and status settings one Change node will do. Change the spoken text in one of them so that msg.payload.text is set to:
                        Code:
                        "The " & msg.payload.name & " is " & msg.payload.status
                        All I did was replaced kitchen door in your image to " & msg.payload.name & " to get the HomeSeer Device's Name to be spoken for the item in question. Then you can wire all the HomeSeer outputs to the one Change node you edited and remove all the rest.
                        That doesn't work in my case since it pulls in the "Feature" instead of the "Name". So, in this example, Alexa says "the Status is now Closed" instead of "The Kitchen Door is now Closed". I don't want to change the feature names in my system. Is there a way to accomplish this with the node name?
                        Attached Files
                        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                        Comment


                          #13
                          Unfortunately you cannot get the sending node's name from the items sent down the flow. "In general nodes should not know or care about other nodes." There are a few options depending on your Device settings:
                          1. Use the item Location (Room or Floor) if it is set to a value which works. You would change msg.payload.name to msg.payload.location or msg.payload.location2 as the case may be. I have a feeling this may not work with your setup, but it was worth mentioning.
                          2. Add a User Note and change msg.payload.name to msg.payload.UserNote. A slightly shorter shot??? You also have msg.payload.voice_command available. Bottom line, SOMETHING needs to come from HomeSeer to do this without going to the next option.
                          3. Add a change node after each HomeSeer device node and set msg.myLocation to the item you wish to be spoken. This DOES give you the flexibility of having the first part of the spoken item to be more unique for each item, but does introduce a change node for each device. I would suggest that you do not add anything to this change node except the items unique to the device. In this case, just this one. Keep the single change node we went to to set the complete spoken phrase and other items. This is more for any possible future changes as the common items are then only changed once. With this you either change msg.payload.name to msg.myLocation or you change the entire setting to something such as
                            Code:
                            msg.myLocation & " " & msg.payload.status
                            .
                          The last item means if we get spud or one of the other good folks at HomeSeer to add the Node's Name to the outgoing message from the Homeseer Node, you can drop the intermediate Change nodes and edit one to use the Node's name. Hopefully that isn't overly convoluted.

                          Let me know if you need any of these explained better.
                          Karl S
                          HS4Pro on Windows 10
                          1070 Devices
                          56 Z-Wave Nodes
                          104 Events
                          HSTouch Clients: 3 Android, 1 iOS
                          Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

                          Comment


                            #14
                            Glad I was late getting back to the house. ksum 's solution was more elegant than mine.
                            "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

                            Comment


                              #15
                              I did the same thing you suggested, kenm . Might have been as a "programmed" spoken phrase, but the basic is the same.

                              I'm guessing we will get a message asking how to pause the announcements during, say a family gathering? Especially one in the summer with people going in and out. Feel free to continue the thread to do that based on the status of a virtual device being "Guests" perhaps.
                              Karl S
                              HS4Pro on Windows 10
                              1070 Devices
                              56 Z-Wave Nodes
                              104 Events
                              HSTouch Clients: 3 Android, 1 iOS
                              Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

                              Comment

                              Working...
                              X