Off Command for Raspberry
-
Re: How to use Off Command (coming soon)
Hi @Russ, One question about .sh you have written this script bellow:
if [ "$1" == "off" ]
then
echo turn cloud $1 >> /tmp/medi_on_off.log
/usr/local/bin/tcmd --trigger "Shutdown now" -- server
else
echo turn cloud $1 >> /tmp/medi_on_off.log
wakeonlan XXXXXXXXXXXXX
fiThe "Shutdown now" is another script in /usr/local/bin/tcmd??? I'm not an expert in linux, so i try to figure it out.
Thanks in advance.
-
@Pr0k0, good question.
That /usr/local/bin/tcmd path is the location of the Raspberry Pi version of the TRIGGERcmd Go executable. It doesn't have to be there, but it's a good spot to put the tcmd executable file.
It looks like that script, after a small tweak, could use your Raspberry Pi (running the TRIGGERcmd agent) to turn a Windows PC (also running the TRIGGERcmd agent) on or off.
The Windows PC would have a command called "Shutdown now" in its TRIGGERcmd agent configuration. The could run this command that shuts it down:
shutdown /s /t 1
The script runs wakeonlan to turn the Windows PC on, and it remotely runs the "Shutdown now" command on the Windows PC to turn it off.
The tcmd command in your script is wrong though. There's no --server parameter. Type tcmd -h to see how to use it.
You can use it to run commands on other computers via TRIGGERcmd. So you could do something like this:
- To turn the Windows PC off you say, "Alexa, turn off Windows Box"
- Alexa tells your Raspberry Pi to run the script via TRIGGERcmd with off as the parameter, which if you look at the script's logic you can see it would run this command (I corrected it below) if the parameter is off:
/usr/local/bin/tcmd --trigger "Shutdown now" --computer "Windows Box"
-
Your Windows PC shuts down.
-
Then to turn the Windows PC on you say, "Alexa, turn on Windows Box"
-
Alexa tells your Raspberry Pi to run the script with on as the parameter, which runs this command which tells your PC to turn on:
wakeonlan C4:65:16:2B:95:97
-
@Russ Thnx for the information i' will give it a go as soon as i will have alexa dot....still waiting due to the whole situation. But I understand what you are trying to say so i will test it and i have have an issue i will post it here. Thnxx again man.
-