Timeout not working in TRIGGERcmd
-
Running a bat file with the timeout command between turning a light on, and turning it off works fine, but when run through TRIGGERcmd, the Timout function is ignored (light goes off after 1 second), any idea why?
I want to turn on the porch light for 5min (300sec) to let the dog out, then have the light go off afterwards. Ideally I'd like to say in minutes the amount of time to leave the light on for through Alexa. Any assistance would be appreciated!
Re: [Stupid Question](but I can't find the answer anywhere: How to make multi-line commands?)
-
@Luvtoski63, that's a cool idea.
I'm not sure why the timeout command is failing. I had the same problem, but I found you can make it work if you prefix it with start /wait like this:
REM Run calculator: calc REM Wait 5 minutes: start /wait timeout 300 REM Kill calculator: taskkill /t /f /im calculator.exe
-
Dang, thanks Russ, that fixed the problem! It works great with a fixed amount of time. I am very new to this so if you don't mind me asking, the batch file for the variable amount of time works from the command prompt, but how do I get Alexa to pass the Timeout value through TRIGGERcmd?
I tried saying the amount of time after saying the Voice/Trigger and I hear back that the Voice/Trigger "does not support that." I have "Allow Parameters" set to "true" and here is the batch file:
"C:\Program Files (x86)\Common Files\X10\Common\ahcmd.exe" sendrf a4 on start /wait Timeout "%1" "C:\Program Files (x86)\Common Files\X10\Common\ahcmd.exe" sendrf a4 off
Thanks for any guidance you can provide.
-
@Luvtoski63, you could use this format:
Alexa, ask triggercmd to run (trigger) with parameter (number of seconds)
You don't need to quote the %1 in your batch file, fyi.
-
Thanks Russ I do appreciate your help; however, either the time parameter is not getting passed correctly or the Timeout function is not working again (back to the original problem even with using "start /wait Timeout %1") as the light goes on then off in about 1 second no matter how much time I say.
-
@Luvtoski63, have your tried typing your parameter into the prompt on the website first? That would determine whether it's an Alexa problem or not.
-
I hadn't but just did and the timer indeed works through the website...so I guess that leaves the problem with Alexa not passing the parameter to TRIGGERcmd...
-
@Luvtoski63, maybe you're saying, "... with parameter 10" and the batch file is getting "ten" instead of "10".
You should add a line to your batch file to log the parameter to a text file, like this:
echo %1 >> c:\tools\params.log
-
@Russ said in Timeout not working in TRIGGERcmd:
echo %1 >> c:\tools\params.log
That is exactly what is happening...and I can't find a way to get her to pass a number instead of text...she just takes the first word after "parameter". I may have to just go with a number of set durations for the timer...thanks for your help.