TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Tasker text to be read by Alexa

    General Discussion
    2
    10
    748
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Red SufiR
      Red Sufi
      last edited by

      Hi all

      is there a way to send a text via tasker to be read aloud by alexa

      i have seen examples of using parameters which can be read by alexa but cant figure it out

      thanks

      RussR 1 Reply Last reply Reply Quote 0
      • RussR
        Russ @Red Sufi
        last edited by Russ

        @Red-Sufi, these are the high-level steps:

        1. Create a command that you run via Tasker that writes Your Text to a text file on your computer. Give it a voice word, like "tasker".

        2. Create a command that runs a script that reads Your Text from the text file and runs %USERPROFILE%\.TRIGGERcmdData\SendResult.bat Your Text
          Give it a voice word, like "speak", and put {{result}} in the Voice Reply field.

        3. Create an Alexa routine that runs when command #1 runs. The routine should run command #2 via a "Custom" action that says, "Alexa, ask TRIGGER C M D to run speak".

        For step #3 you'll need to enable the TRIGGERcmd Smart Home skill so command #1 shows up in the list under When this happens - Smart Home in the routine configuration.

        For step #3 you'll also need to enable the TRIGGERcmd skill for the custom action to work, and for the Voice Reply field to be used in the Alexa response.

        For reference, these articles might help:

        https://www.triggercmd.com/forum/topic/341/voice-reply-field-now-allows-placeholders-for-trigger-computer-and-params

        https://www.triggercmd.com/forum/topic/1844/run-an-alexa-routine-when-a-command-runs

        https://www.triggercmd.com/forum/topic/2046/have-alexa-say-result-of-long-running-process-like-chkdsk

        Russell VanderMey

        Red SufiR 1 Reply Last reply Reply Quote 0
        • Red SufiR
          Red Sufi @Russ
          last edited by

          @Russ thanks im having a look at these

          i tried running the When did i last reboot command from examples and nothing happened. Is that because i do not have tcmd command line tool installed?

          does the script just need my profile name replaced such as follows

          redsufi.TRIGGERcmdData\SendResult.bat Your Text

          do i need to replace the bit Your Text with a variable name from part 1 ?

          sorry for the noob questions

          thanks

          RussR 1 Reply Last reply Reply Quote 0
          • RussR
            Russ @Red Sufi
            last edited by Russ

            @Red-Sufi, this is the SendResult.bat file on Windows:

            if "%~1"=="" goto noparams
            goto yesparams
            
            :noparams
            echo "You need to specify the command result as a quoted sentence like this:"
            echo SendResults.sh "This is the result of my command."
            goto end
            
            :yesparams
            set /p TCMD_TOKEN=<%USERPROFILE%\.TRIGGERcmdData\token.tkn
            curl -X POST https://www.triggercmd.com/api/command/result -H "Authorization: Bearer %TCMD_TOKEN%" -H "content-type: multipart/form-data" -F computer_id=%TCMD_COMPUTER_ID% -F command_id=%TCMD_COMMAND_ID% -F result=%1 >> %USERPROFILE%\.TRIGGERcmdData\results.log
            
            :end: 
            

            You can see it uses the curl command which does not come with Windows by default. You can install it from here. You don't need the tcmd.exe program.

            You could use the full path to SendResult.bat, including your redsufi username, or you could use the USERPROFILE environment variable like this:

            "%USERPROFILE%\.TRIGGERcmdData\SendResult.bat"

            Yes, if you want Alexa to say the text (example: Your Text) you sent from Tasker via TRIGGERcmd command parameters (and wrote to a text file), you need to read that text file in command #2 and run SendResult with that text, like this:

            "%USERPROFILE%\.TRIGGERcmdData\SendResult.bat" "Your Text"

            Russell VanderMey

            Red SufiR 1 Reply Last reply Reply Quote 0
            • Red SufiR
              Red Sufi @Russ
              last edited by

              @Russ thanks again

              im making progess but still having problems with Alexa saying the replies

              i think im having the same issues reported here

              https://www.triggercmd.com/forum/topic/1013/alexa-not-saying-voice-reply/4

              you can see in the screenshot below that my command did successfully run with the result but its not read by alexa

              66494091-206a-40f1-a757-6527726b3171-InShot_20230524_192121072.jpg

              i had both the original skill https://www.amazon.co.uk/gp/product/B06XFN2TZN

              and the smart home skill linked

              i tried just using the original skill and it would still run but again Alexa would not read it

              any ideas?

              RussR 1 Reply Last reply Reply Quote 0
              • RussR
                Russ @Red Sufi
                last edited by Russ

                @Red-Sufi, you got Result: readmealexa.

                Now, to have Alexa say, "The result was readmealexa," put this in your command's Voice Reply field, and use the TRIGGERcmd, TC, or Trigger Command Alexa skill (not TRIGGERcmd Smart Home).

                57650a32-cabd-48f1-b17e-98fe54d7faf2-image.png

                Russell VanderMey

                Red SufiR 1 Reply Last reply Reply Quote 0
                • Red SufiR
                  Red Sufi @Russ
                  last edited by

                  @Russ thanks

                  funny thing is i did try that

                  b6af14c1-3a36-4e34-8a88-c14b3c2c89d8-image.png

                  i tried remove params and made no difference and i tried using TRIGGERcmd, TC, and Trigger Command Alexa skill, and none of them worked

                  RussR 1 Reply Last reply Reply Quote 0
                  • RussR
                    Russ @Red Sufi
                    last edited by Russ

                    @Red-Sufi, I think you probably have those Alexa skills activated, but you're not actually using them. To use one of them, you would need to say one of these (because your voice field has "trigger command" in it:

                    Alexa, ask TRIGGERcmd to run trigger command
                    Alexa, ask Trigger Command to run trigger command
                    Alexa, ask TC to run trigger command

                    That will run your command, and Alexa will wait a few seconds for a "result" because you have {{result}} in the Voice Reply field.

                    I figure you should make sure the above works first, to prove the concept, but I know your final goal is to have Alexa say the words from Tasker, so you could have command #1 run this Windows batch file script:

                    tasker_write_text.bat

                    echo %1 %2 %3 %4 %5 %6 > %TEMP%\tasker_text.txt
                    

                    And have command #2 run this Windows batch file script:

                    alexa_read_text.bat

                    @echo off
                    
                    set FILE=%TEMP%\tasker_text.txt
                    set /p TEXT=<%FILE%
                    
                    echo Running SendResult.bat with parameter(s): %TEXT%
                    
                    "%USERPROFILE%\.TRIGGERcmdData\SendResult.bat" %TEXT%
                    

                    Let me know if you need a screenshot of the Alexa Routine for step #3.

                    Russell VanderMey

                    Red SufiR 1 Reply Last reply Reply Quote 1
                    • Red SufiR
                      Red Sufi @Russ
                      last edited by

                      @Russ
                      ive finally got this to work with your help

                      i didnt know how to implement tasker_write_text.bat but used a combination of autoremote,tasker and eventghost to create the text file

                      many thanks for your help and patience

                      RussR 1 Reply Last reply Reply Quote 0
                      • RussR
                        Russ @Red Sufi
                        last edited by

                        @Red-Sufi awesome. Good job.

                        Russell VanderMey

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post