Announcement

Collapse
No announcement yet.

Does HS4 know which Echo device triggered something?

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

    Does HS4 know which Echo device triggered something?

    *** Cross posted from the Alexa Skill sub-forum, maybe some folks here have some ideas ***

    I've got the "Alexa - HomeSeer SmartHome Skill" setup successfully and can trigger Events and Devices.
    I've got NodeRed setup successfully so that HS4 to Echo TTS works correctly.

    So here's my use-case/question:

    I've setup events on HS4 and successfully imported them to Alexa as Scenes. I can trigger them using phrases and routines in Alexa I defined.
    These scenes do many things and will construct some text into the status of a virtual device. This virtual device status then triggers a flow in NodeRed for TTS to an Echo device.
    My question is, how to I do TTS based on Echo device location? In other words, if I trigger the HS4 Event/Scene from my den via Alexa, I want the response constructed by HS4 to go back to the same Echo device that triggered the original event.

    Not sure how to accomplish this or if it's even possible? Is the Echo trigger device room assignment being passed to HS4 in the Homeseer skill? Can NodeRed figure out the last Echo device that was used in Alexa account?


    #2
    I do not know if HomeSeer knows which Alexa device triggered but the commonly used Node-RED contribs (node-red-contrib-alexa-remote2 and the branches such as cakebake and applestrudle) do report which Alexa device heard the command. Take a look at the flow in this post to see how we determine which unit heard the command and how we use that information. Note that you can build the text in Node-RED instead of a virtual device. Aslo note that if you are using the instructions which set the text in a virtual device and then set the virtual device to no string and filter that out, you can simply change the virtual device so the setting Last Change Time Updates on Status Change Only is not checked. This is discussed starting here. Further in that thread you will see that you can remove the portion of the original flow design which filters on an empty status.

    To the best of my knowledge and belief, in order to report back to the same Alexa device, you may need to use Node-RED to hear the command and trigger your Event. I would then use Node-RED to build the response and send it to the correct device. We can work that all out here if needed.

    Karl
    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


      #3
      Karl, you once again came through. While I appreciate the detailed suggestion, the one piece I was missing was knowledge of the "On Device Activity" node in the remote2 contrib, thank you for bringing it to my attention by referencing the other message thread in the forums. Since that has a payload of the last activated Echo device in the account, I can use that with a switch node to "steer" TTS to the appropriate Echo device (I think, haven't worked it out yet) in my NodeRed flow when HS4 needs to send a message. That way the human can have a conversation with one Echo device without the responses going all over the house.

      As previously stated, I want home automation logic and status text construction to stay on HS4, NodeRed is simply the conduit for TTS to Echo devices. Depending on other parameters, the event message from HS4 might goto a SMS, voice announce, or email at different times of the day. I see no reason to replace the event engine and functionality already built into HS4.

      Once again, your suggestion got me in the right direction!

      Comment


        #4
        You do not need to send output to different nodes for different Alexa devices. You can control which device responds with the message you send to the Alexa node. The flow I referenced only responds via the same Alexa unit which heard the command.

        Note that you want to limit the number of nodes you have which output to Alexa units. Alexa (or possibly the contribs) does not like receiving multiple Node-RED messages too quickly. Best to have all output go through a single Alexa node and make sure you are only sending one message at a time with a delay between any coming in. Use a Delay node and set the Action inside it to Rate Limit so you can limit the rate at which messages go to the Alexa node. I have not done much testing as I use Google Home units, but with what little I have done, 1 second seem to suffice.
        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
          So here's my question: How to do i steer the output of my HS4 virtual device text to the right Alexa device based on the msg.payload.name of the Device Activity node? I basically need a "train switch" that stays in place to guide messages to the correct Alexa device.

          Click image for larger version

Name:	Capture.PNG
Views:	348
Size:	27.8 KB
ID:	1509703

          Comment


            #6
            First, you may want to test to make sure there will be output to your tablet. My tests using the Amazon Alexa app on my Android phone did not push speech out through the app. A Fire tablet may be different.

            You will want to use the Join node with the mode set to Manual and combine each msg.payload to create a merged object. Before the Join node, set the incoming messages to only have the parts you need, including the Echo device name for the speech to go out of, and you should be good. I am going to be away from the computer for the evening and couldn't get my test device to speak at all, else I would provide an example flow. It just keeps flashing green at me and won't even tell me the time. It isn't normally plugged in. Basically the will likely look like this, but the meat of what is happening isn't worked out.
            Click image for larger version

Name:	HS1.png
Views:	367
Size:	19.9 KB
ID:	1509716

            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


              #7
              Originally posted by ksum View Post
              First, you may want to test to make sure there will be output to your tablet. My tests using the Amazon Alexa app on my Android phone did not push speech out through the app. A Fire tablet may be different.

              You will want to use the Join node with the mode set to Manual and combine each msg.payload to create a merged object. Before the Join node, set the incoming messages to only have the parts you need, including the Echo device name for the speech to go out of, and you should be good. I am going to be away from the computer for the evening and couldn't get my test device to speak at all, else I would provide an example flow. It just keeps flashing green at me and won't even tell me the time. It isn't normally plugged in. Basically the will likely look like this, but the meat of what is happening isn't worked out.
              Click image for larger version

Name:	HS1.png
Views:	367
Size:	19.9 KB
ID:	1509716

              Thank you Karl. I was able to follow what you explained and now when I tell Alexa Goodnight it runs different routines base on what room I am in!

              Do you happen to know if this could be taken even a step farther and be able have an event run based on the Alexa voice profile?

              Comment


                #8
                The iobroker adapter is made from the same guy that made the alexaremote library. So I guess, if it is not on this page , it is not possible for the moment.

                https://github.com/Apollon77/ioBroker.alexa2

                Comment


                  #9
                  Originally posted by jmhitchcock View Post


                  Thank you Karl. I was able to follow what you explained and now when I tell Alexa Goodnight it runs different routines base on what room I am in!

                  Do you happen to know if this could be taken even a step farther and be able have an event run based on the Alexa voice profile?
                  By voice profile, do you mean who made the request? I see there is this variable being passed as an array, but mine is empty. It is only me who uses Alexa here as I only use it for testing and helping out with flows for others.
                  payload.data.personsInfo
                  If you wire a Debug node to the output of an Alexa Event node you can see if this has a value for you. If it does, and you need assistance, copy the full value and post here so we can see what might be possible.
                  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
                    Originally posted by ksum View Post

                    By voice profile, do you mean who made the request? I see there is this variable being passed as an array, but mine is empty. It is only me who uses Alexa here as I only use it for testing and helping out with flows for others.
                    payload.data.personsInfo
                    If you wire a Debug node to the output of an Alexa Event node you can see if this has a value for you. If it does, and you need assistance, copy the full value and post here so we can see what might be possible.
                    I saw that too. Currently I only have a voice profile for me. I have found the right time to ask my wife to set up one for her.

                    Comment

                    Working...
                    X