Tasker text to be read by Alexa
-
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
-
@Red-Sufi, these are the high-level steps:
-
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".
-
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. -
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/1844/run-an-alexa-routine-when-a-command-runs
-
-
@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
-
@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"
-
@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
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?
-
@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).
-
@Russ thanks
funny thing is i did try that
i tried remove params and made no difference and i tried using TRIGGERcmd, TC, and Trigger Command Alexa skill, and none of them worked
-
@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 commandThat 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.
-
@Russ
ive finally got this to work with your helpi 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
-
@Red-Sufi awesome. Good job.