Can you feed back information to Alexa
-
Hello
Can you feed back information to Alexa?
For excample I could pick up a value from my linux box and I want Alexa to tell me.
for excample:
- Alexa - what is the Temo
- run script which retrieves a sensor value
- Alexa tell me the value
Best regards
Stefan -
@snantz, this is the second request for something like this. I've been thinking about how I would implement that.
I'm thinking I could give an option you could enable on each command to tell Alexa or Google Assistant to wait a few seconds for a response from the computer. If the computer sends a response, then Alexa or Google Assistant would speak the text in the response. I'm thinking the response could be sent with a curl or tcmd command.
What do you think?
-
@Russ, How would I tell alexa to wait for and out put? Or does it by itself?
-
@snantz, I haven't added that voice response feature yet, but when I do, this is how it will work:
If you put {{result}} in the Voice Reply field of your command (like this), Alexa or Google Assistant will wait up to 5 seconds for a result to be sent from the computer, and include it in the voice response.
If you upgrade to the latest version of the agent (as of 1/6/19), you'll now find a new sendresult.bat or sendresult.sh file depending on your computer's operating system. You can send the result of your triggered script by adding this to the end of it:
Windows:
%USERPROFILE%\.TRIGGERcmdData\sendresult.bat "My command result"
Linux or Mac:
sh ~\.TRIGGERcmdData\sendresult.sh "My command result"
Today the sendresult script just logs your result in the command's Runs list, but this is the ground-work for this voice feed back feature you asked for.
-
Still learning when it comes to using TriggerCMD and this trigger sounds like a great idea as I've been wanting to find ways to have Alexa provide me information about different things - mostly all pertaining to status and data for home automation system. Can anyone provide any examples of what they're doing with this and what feedback they're using. What feedback can be given anyway? For example could you run an sudo apt update command and have Alexa tell you how many packages were updated?
-
@gnetdevelopment, so far I've only implemented the ability to send feedback to the Runs history for each command.
Now that that's done, I'm planning to add the ability to have Alexa or Google Assistant wait a few seconds for a result to be sent back, then say the result.
Let's say you wanted to know how many packages can be upgraded on your Raspberry Pi. You could add a command that would run this script:
#!/bin/bash export UPGRADABLE_COUNT=$(apt list --upgradable | grep upgradable | wc | cut -f 6 -d " ") sh ~/.TRIGGERcmdData/sendresult.sh "${UPGRADABLE_COUNT} packages could be upgraded."
It would look like this in the website, and when I get the Alexa and Google Assistant work done, you could have the result spoken when you run it by voice.
-