Announcement

Collapse
No announcement yet.

A new node red module that implement Some Alexa control. Yes it include TTS

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

  • A new node red module that implement Some Alexa control. Yes it include TTS

    I personally use openhab for this. But this node make it more easy to integrate Alexa to HS3 via mqtt!

    https://flows.nodered.org/node/node-...b-alexa-remote

    Clicking around a saw it was indirectly based on the openhab work.

    If this node package become rock solid like the one of openhab... and we developp a way to CONTROL PLEX like the openhab binding... i will completly uninstall openhab of my system.


    So ...download it and report bug to the autor https://flows.nodered.org/node/node-...b-alexa-remote


    edit: kind of hard to connect. ..
    Last edited by MattL0; September 21st, 2018, 11:29 PM.

  • #2
    ok got it working , you have to connect to alexa web app. and after that you have to copy paste the cookies:

    Comment


    • #3
      So on chrome :

      right click somewhwre on the page and click inspect.
      Click on the network tab.
      Press f5
      pick one of the name in the list
      click on the header tab
      scroll down to cookie ( if you do not see it click on another name)
      copy all what is in here and paste it in the cookie section of the node-red node. ( note host : alexa.amazon.com and paste it to ''amazon page '' field of the node-red node
      Attached Files
      Last edited by MattL0; September 22nd, 2018, 12:13 AM.

      Comment


      • #4
        Originally posted by MattLau View Post
        So on chrome :

        right click somewhwre on the page and click inspect.
        Click on the network tab.
        Press f5
        pick one of the name in the list
        click on the header tab
        scroll down to cookie ( if you do not see it click on another name)
        copy all what is in here and paste it in the cookie section of the node-red node. ( note host : alexa.amazon.com and paste it to ''amazon page '' field of the node-red node
        Hi I'm trying to get this working, I've setup the account settings as you've documented, however in my "flow" I only have 1 element "Alexa speak node", when I click deploy nothing happens. In your flow you have 3 elements, are all these required?

        Appreciate any help, just new to node-red.

        Thanks

        Comment


        • #5
          Originally posted by Megaman View Post

          Hi I'm trying to get this working, I've setup the account settings as you've documented, however in my "flow" I only have 1 element "Alexa speak node", when I click deploy nothing happens. In your flow you have 3 elements, are all these required?

          Appreciate any help, just new to node-red


          Thanks
          Maybe this nnode red package has changed.


          But, yes, you need a trigger ( the blue node) . The green one is for debugging ( in this case i can see the payload message ''''wat'sup ''.


          there is a way to pass message payload without using the flow recurring trigger ( blue node).

          will try to show you. But i do not use this method personally. I use openhab.


          btw the node red package name is now: node-red-contrib-alexa-remote2

          Comment


          • #6
            I think this will explain this npm better than me. :

            https://github.com/586837r/node-red-...-alexa-remote2


            edit: you need to send a message in the json format from mqtt.

            then the mqtt node will pass the message to the alexa node.


            To begin with the package you could just do what i did in the picture on the next post
            I think if you send a message with a ',1', as a payload it would trigger the alexa node . Let me know

            Comment


            • #7
              This is what the new package looks like

              EDIT : chek the second picture. this is an event that will trigger the nodered alexa node.

              edit2: I can confirm it works
              Attached Files

              Comment


              • #8
                Later on...When you will feel more conftable with json formatting you could write something like this in the event payload of the Homeseer mqtt event`:

                Payload is copy pasted from the npm alexa page ( ex#1) ( it would take me too long to decript all this tonight cuz i am not a programmer

                , basically this payload is sending multiple commands to multiple echo device.

                edit : this payload is from of a node red only setup. If you go that route (

                writting the payload from homeseer ; your payload won't be that long)


                Code:
                 MCSMQTT/ThisISFromMqttPlugin=[{"id":"495c1858.223988","type":"tab","label":"Alexa Speak Basic","disabled":false,"info":""},{"id":"9aaa747f.77dd58","type":"ui_text_input","z":"495c1858.223988","name":"","label":"","group":"f5f6c00c.16c28","order":3,"width":0,"height":0,"passthru":true,"mode":"text","delay":"1","topic":"","x":140,"y":220,"wires":[["e02c877b.86a0d8"]]},{"id":"e02c877b.86a0d8","type":"change","z":"495c1858.223988","name":"","rules":[{"t":"set","p":"speakText","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":220,"wires":[[]]},{"id":"61b3b44b.f9fe7c","type":"ui_button","z":"495c1858.223988","name":"","group":"f5f6c00c.16c28","order":4,"width":0,"height":0,"passthru":false,"label":"Speak","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":130,"y":260,"wires":[["a9588a39.ada738"]]},{"id":"a9588a39.ada738","type":"alexa-remote-sequence","z":"495c1858.223988","name":"","account":"fb0d8688.41ff08","serialOrName_type":"flow","serialOrName_value":"device","sequenceInputs":[{"command":"speak","value_type":"flow","value_value":"speakText"}],"x":360,"y":260,"wires":[[]]},{"id":"b47979d7.fa6d98","type":"change","z":"495c1858.223988","name":"","rules":[{"t":"set","p":"device","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":160,"wires":[[]]},{"id":"393eea6d.9c5506","type":"alexa-remote-get","z":"495c1858.223988","name":"","account":"fb0d8688.41ff08","target_type":"select","target_value":"devices","serialOrName_type":"str","serialOrName_value":"","options":{"devices":{},"cards":{"limit":{"type":"num","value":"10"},"beforeCreationTime":{"type":"str","value":"%t"}},"media":{},"playerInfo":{},"list":{"size":{"type":"num","value":"100"},"startTime":{"type":"str","value":""},"endTime":{"type":"str","value":""},"completed":{"type":"bool","value":"false"},"listType":{"type":"select","value":"TASK"}},"wakewords":{},"notifications":{"cached":{"type":"bool","value":"true"}},"doNotDisturb":{},"deviceNotificationState":{},"bluetooth":{"cached":{"type":"bool","value":"true"}},"activities":{"startTime":{"type":"str","value":""},"size":{"type":"num","value":"1"},"offset":{"type":"num","value":"1"}},"account":{},"conversations":{"latest":{"type":"bool","value":"true"},"includeHomegroup":{"type":"bool","value":"true"},"unread":{"type":"bool","value":"false"},"modifiedSinceDate":{"type":"str","value":"1970-01-01T00:00:00.000Z"},"includeUserName":{"type":"bool","value":"true"}},"automationRoutines":{"limit":{"type":"num","value":"2000"}},"musicProviders":{},"homeGroup":{},"devicePreferences":{},"smarthomeDevices":{},"smarthomeGroups":{},"smarthomeEntities":{},"smarthomeBehaviourActionDefinitions":{}},"x":350,"y":100,"wires":[["c1c89249.16e6f"]]},{"id":"1bdbe539.4ea10b","type":"inject","z":"495c1858.223988","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"0","x":150,"y":60,"wires":[["393eea6d.9c5506"]]},{"id":"c1c89249.16e6f","type":"change","z":"495c1858.223988","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"payload.devices.accountName[]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":160,"y":160,"wires":[["51dc169b.0cc3e8"]]},{"id":"51dc169b.0cc3e8","type":"ui_dropdown","z":"495c1858.223988","name":"","label":"Device","place":"","group":"f5f6c00c.16c28","order":1,"width":0,"height":0,"passthru":true,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":330,"y":160,"wires":[["b47979d7.fa6d98"]]},{"id":"229465fa.2a93ca","type":"ui_button","z":"495c1858.223988","name":"","group":"f5f6c00c.16c28","order":2,"width":0,"height":0,"passthru":false,"label":"Refresh","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":140,"y":100,"wires":[["393eea6d.9c5506"]]},{"id":"f5f6c00c.16c28","type":"ui_group","z":"","name":"Alexa Speak","tab":"e44a6ba2.3e2b08","order":1,"disp":true,"width":"6","collapse":false},{"id":"e44a6ba2.3e2b08","type":"ui_tab","z":"","name":"Alexa Speak","icon":"speaker","order":2}]

                so it would looks like :

                Attached Files

                Comment


                • #9
                  Thanks for the tips, will let you know how I go.
                  Cheers

                  Comment


                  • #10
                    Ok I have it working now thanks to your tips!
                    Now I'm trying to pass a string from HS to MQTT, If I pass a value from HS->MQTT eg Hello, alexa will speak the msg.payload which is "Hello", however if I use a string with spaces it fails, I've tried using %20 as the space "Hello%20World", problem is alexa says "Hello 20 world".
                    Any ideas?

                    update
                    I managed to resolve this by using a function, not sure if this is the best method but it works
                    Code:
                    var topic=msg.payload; //get topic
                    msg.topic=topic.replace("%20"," ");
                    return msg;
                    update 2
                    Better solution is to use single quotes around the string, then a function isn't required.
                    Code:
                    mcsMQTT/HSVoiceMsg='Hello There'

                    Comment


                    • #11
                      Has anyone managed to get the user/pass options to work, I keep getting authentication errors, I've doubled checked the credentials and 2FA is disabled.
                      Cookie method works, however as it expires it's not reliable.

                      Thanks

                      Comment


                      • #12
                        I m using openhab bining. I sen all theinfo to homeseer with mqtt (via nodered).

                        the conmection is rock solid. And way faster than myhs

                        Comment


                        • #13
                          I tried it hear and it worked fine for a bit until I had to redo the cookie thing....went off on a tangent and trying a new python script which keeps you logged in after first time running it. It works great for Alexa TTS and using the Alexa as a media player.

                          This though right now is with using Home Assistant. Home Assistant recognizes Squeeze Players and Alexa devices as media players and you can utilize Google or Alexa for TTS.

                          The script is simple and needs no adjustments and you just put in your authentication stuff in the configuration.yaml file.

                          Wrote about it here: Home-Assistant Alexa Media Player options

                          Concurrently testing similiar here with the Smartthing Smarthub. Much easier to do the TTS with Python.

                          Doing the Alexa events here using MQTT and hard wired sensors or soft sensors (Modded WiFi sensors).

                          Click image for larger version

Name:	kitchenalexa.jpg
Views:	472
Size:	43.6 KB
ID:	1282177

                          xxx
                          - Pete

                          Auto mator
                          Homeseer 3 Pro - 3.0.0.534 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU - Mono 6.4X
                          Homeseer Zee2 (Lite) - 3.0.0.534 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.4X

                          X10, UPB, Zigbee, ZWave and Wifi MQTT automation.

                          Comment


                          • #14
                            Originally posted by Pete View Post
                            I tried it hear and it worked fine for a bit until I had to redo the cookie thing....went off on a tangent and trying a new python script which keeps you logged in after first time running it. It works great for Alexa TTS and using the Alexa as a media player.
                            I don't use Home Assist, does the python script work with HS?

                            Comment

                            Working...
                            X