Feedback on triggers
-
@russ First, I love what you did, it's answering a lot of needs, thank you for your contribution!
I want to know if I can / will be able to get alexa to draw output of some shell script that I can ask her to run remotely, for example:
Alexa, ask triggercmd to run backup
and when backup script is finished, she will say the exit code or exit command like:
"Backup successful!"
or:
"Backup failed!"
Is it possible? Will it be?Thank you!!
-
@tal-sabadia, This is possible now using "voiceReply": in your commands.json file. There are a few examples in the Raspberry pi Example commands.
How well it would work for a backup I'm not sure. -
@tuicemen Thanks for replying so fast!
Well, it's not just about backup. That was just an example.
I'm talking on Amazon Echo 4th, not Raspberry Pi.
I just want to receive feedback off of what I'm running, the exit code or some echo command.For example, if I'm doing it without alexa, say running a simple script of echo "hello", I want to know if that was successful or make alexa say "X was done successfuly" or not if it didn't, know what I mean?
-
@tal-sabadia I made a couple of scripts which reply back results to Alexa if triggered from Alexa.
If you wish to trigger without Alexa and get Alexa to reply when it is finished you'd need something like https://voicemonkey.io/
TRIGGERcmd can't currently do this.. -
@tal-sabadia and @tuicemen , fyi, the voiceReply field only works with the TRIGGERcmd and TRIGGER command skills, not the TRIGGERcmd Smart Home skill.
So if your backup is really quick, it will work. You need to run the SendResult.bat or SendResult.sh script from the script your command ran within about 6 seconds. That's about all Google Assistant and Alexa allow for a reply to a voice command.
This is a little complicated, but it would work:
- At the end of your backup script, write the result to a file saying "succeeded" or "failed".
- After that, the same script would run another TRIGGERcmd command using curl or the tcmd tool that does nothing (just have it run echo), but it's tied to an Alexa routine.
- The Alexa routine's action would run a third triggercmd command with result in the voice field using a custom action that says, "ask TRIGGER C M D to run result".
- The command with result as its voice word will run a script that reads the file your backup script wrote, then either run ~/.TRIGGERcmdData/sendresult.sh succeeded or ~/.TRIGGERcmdData/sendresult.sh failed depending on what it finds in that file.
- Your Alexa will say, "The backup succeeded" if you have this in your Voice Reply field and the backup succeeded. {{result}} is a placeholder for what you send back with the sendresult.sh script.
Notice too I picked my Office Alexa as the one that will say the result of the backup.
You'll need the TRIGGERcmd skill enabled for this to work. Or enable the TRIGGER command skill and substitute "ask TRIGGER C M D to run result" above with "ask trigger command to run result".
-
@russ, I did know the smarthome skill wouldn't work for this. But didn't realize I could have Alexa or Google respond to a script ran manualy with a TRIGGERcmd call inside to enable a voice responce. This is cool and has me thinking of some new Ideas.
-
@tal-sabadia, there is a way to get a simple "failed" or "succeeded" voice response for a long script run or a script that you trigger manually.
- 1: It requires creating two TRIGGER.cmd dummy scripts (dummy1 & dummy2) that simply echo "OK" when ran from command line.
- 2: At the end of the backup script have them triggered (using the tcmd tool found here https://www.triggercmd.com/forum/topic/196/tcmd-go-command-line-tool-is-available-now) based 1 on a fail and other on a succeed result.
- 3: In Alexa routines create two, one for dummy1 that Alexa says something like, "Trigger C M D reports script succeeded"
The other for dummy2 that Alexa says something like, "Trigger C M D reports script failed"
This way you can use the same routines and dummy scripts for several different long running scripts and even for scripts that aren't started by TRIGGERcmd
-