Alexa invocation and SmartThings switch questions

  • Sorry, im very new here. I have not set up Triggercmd yet and wanted to ask something before, if, i do.

    Im looking to integrate my htpc into alexa via smartthings and this looks perfect. I have been putting off setting up eventghost for this purpose because ... well.. laziness and the setup.

    After reading the forum here a bit, im suddenly not as sold.

    Once installed, to invoke TC do i need to say "Alexa, trigger trigger command blah on blah blah" ?

    I found this program from youtube via reddit on how to link pc to smartthings. they show creating a virtual switch, which if i understand it would be perfect, "Alexa, turn on Kodi" then the switch i created to turn on kodi would launch it via command line. but if i have to say "alexa, trigger trigger command to turn on kodi on htpc" i think ill find something else.

    Similarly, if said switch is created in smartthings, can on and off be seperate commands? Ideally when i turned off said "launch kodi" switch i can have the correct command to kill said program.

    I understand this is probably explained in the install and set up of commands but I dont want to install and spend time setting up something to find it doesnt meet my needs and have to instantly uninstall.

    Thanks for the time to read these questions.. i understand if i dont get a reply but it would save time for new users.

  • @Neflhiem, good questions. I'm all about improving this TRIGGERcmd software, so I hope you'll work with me on this.

    I didn't think of naming the SmartThings virtual switches so they would be easy to say to Alexa. Right now they're named like this:

    DS > Calculator

    ... where DS is my computer name, and Calculator is the trigger name.

    I just tested renaming my virtual switch, and it didn't work, but if that worked, you could say things like:

    Alexa, turn on Kodi
    Alexa, turn on Kill Kodi

    That first one is pretty good, but that second one is still a little awkward.

    If you use the Alexa Skill and make your HTPC your default computer, you could say:

    Alexa, tell TRIGGERcmd to run Kodi
    Alexa, tell TRIGGERcmd to run Stop Kodi

    I agree though, that's a lot to say.

    If you have a Google Home device, you could make a shortcut for each, so you could say:

    Hey Google, Start Kodi
    Hey Google, Kill Kodi

    That last one isn't bad at all, but you probably don't have a Google Home device. If you have an Android or iPhone you could try it out on your phone.

    Let me know if you think I should allow renaming SmartThings switches. I think that's probably worth doing - not just for this use-case, but for people who have long computer names and don't want to shorten them.

  • @Russ Sorry no GH device.. im trying to limit my home automation and make what i have work.. its pretty much an Echo Dot, Smartthings hub, some zwave switches, LIFX bulbs, Magiclight (Flux) bulbs and a couple Fibaro LED controlers.

    I really think this would be the perfect pc side server for me (better than event ghost) due to your integration with smartthings. Im trying to run all my routines through smartthings as opposed to a mix with Stringify, IFTTT when i can.

    Honestly, what would make this my go to would, as disussed in the other thread, maybe a different type of vitural switch that allows me to set the on then the off commands seperate. not just a toggle type switch as you described.

    This would allow me to integrated direct into smartthings, action tiles (would show correct.. if the tile is lit, the apps running, if its not its off.. i see lots of uses for that) and allow for simple more natural commands. "Alexa, Turn on/off ......" Honestly, now that i think about it.. you could make that a premium feature, while without would be a non paid version.. thats an upgrade id certainly pay for after trying the base software.. just a thought.

    The Google home part sounds great.. maybe someday Amazon will get on board with the shortcuts ideas, but if its as simple as your example above.. that sounds awesome.

  • @Neflhiem, I was thinking about how I would implement this change to the SmartThings integration. Here's what I'm thinking now:

    If the command allows parameters, then the SmartThings virtual switch will behave differently - it will run the command with a on as a parameter when you turn the switch on, and off as a parameter when you flip the switch off.

    Your command would run a script like c:\scripts\KodiOnOff.bat that would except a parameter like this batch file:

    if "%1"=="on" "C:\Program Files (x86)\Kodi\kodi.exe"
    if "%1"=="off" taskkill /im kodi.exe

    What do you think?

    I liked that idea so I went ahead and updated the SmartThings code to send on or off as a parameter when you toggle the virtual switch on and off.

    If the command doesn't allow parameters, then the command just runs when you toggle the switch off and on.

    I also removed the > in the switch name so it's a little more voice friendly.

    If you've already installed the SmartThings code, you'll have to go back here to find the new code and update it in your SmartThings developer account.

    Now I can say:

    Alexa, turn on DS Kodi
    Alexa, turn off DS Kodi

    EDIT 10/15: Now I say these because DS is my default computer:

    Alexa, turn on Kodi
    Alexa, turn off Kodi

  • THAT IS FREAKING GENIUS!! I can turn it on and off!

    I have several uses for this as my pc is my main home audio input. I can start my media player with 9 hours of "white nose" and have it auto shut off in the morning with the same switch.

    Also I can shut off my internet phone and turn it on in the morning!


  • @Nate-Hales, I knew you'd have some use cases for this.

  • @Russ .... I vote to be able to get rid of the computer name "DS" at least for the default computer. .. Alexa, turn on Kodi
    Alexa, turn off Kodi

    Maybe only add the computer name f people have more than one computer. I bet 99% of us only use one main computer.

  • @Nate-Hales, I think you're right. I'll work on it.

  • @Russ If trigger does not force the Default computer name into the name of the smartthings switch ... then my Alexa would throw the smartthings switch no problem. :)

  • This rocks! I am totally launching games like this. "Alexa, Turn on Rocket League". It will also be great for when I rage quit "ALEXA, TURN OFF ROCKET LEAGUE!"

  • @Russ STOP CODING!! IT WORKS HOW I WANT ALREADY :) @Neflhiem will like this as well because he can now just speak the name of the switch (without saying anything before it) <--- In here:
    I just deleted my computer name (made it blank) and the voice name blank (I had to put one in space-bar to allow it to save) .

  • What am I doing wrong? I am trying to make a .bat file to turn on and off my x-10 lamps... I kinda have no clue how to set up parameters... I just tried to copy you. :) 0_1507784819049_Param.jpg

  • @Nate-Hales, your batch file needs == where you have Front Room Lamps

    if "%1"=="on" curl http://.....%%22A6%%20off%%22
    if "%1"=="off" curl http://.....%%22A6%%20off%%22

    Sorry I was lazy and didn't want to type your full URL but I think you know what I mean. The double % signs are to "escape" your % signs so the batch file parser doesn't think %2 is your second parameter.

  • @Nate-Hales, I see what you mean, but there are people with multiple computers (like me) who need to have a actual computer names (not space) to distinguish them.

    I think I like your original idea - to leave the computer name out of the virtual switch name if it's your default computer.

    I'm glad you have a work-around in the meantime. I might not have time to finish this change until this weekend. We'll see. I'm eager to get it done.

  • wow... well i know what ill be doing tonight when i get in! this looks great @Russ ! Im not good with command line stuff but this looks simple enough to figure out. With all the conversation here it looks like i can pretty much set up everything to work perfectly.. So glad i dropped in to figure this out.. You rock.

  • Thanks @Neflhiem!

    BTW, now the virtual SmartThings switches for your default computer are named without your computer name. The switches for your non-default computer still have the computer name prefix.

    Next I'd like to make it so if you only have one computer, then it's automatically your default computer. I should have done that a long time ago.

  • Got it up and running. Man.. this is friggin perfect. Seriously.. perfect.

  • @Neflhiem, I'm glad you got it working. I like how it turned out too. Thanks again for your questions - I wouldn't have thought to implement this if you hadn't asked.

Log in to reply