TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Central Server to send commands to multiple PCs

    Windows
    2
    12
    892
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Richard BinckleyR
      Richard Binckley
      last edited by Richard Binckley

      I don't know if this is the right place for this post and if not, please relocate where it needs to be.

      My wife is visually impaired can I use TriggerCMD to set up voice commands for her. We have a combination of Alexa enable light switches and x10 light switches. So I set up the TriggerCMD combined with and autohotkey script to control the x10 light switches. My home automation system consist of several PCs, one of which is a central server and the TriggerCMD default computer where the commands for the X10 light switches are located. There are two more PCs that are used as HTPCs running Windows 7 Media Center.

      On my wife's HTPC she can either tune and local broadcast stations or youtubeTV cable stations using a remote control. She can also access other streaming services by entering a channel number that I have assigned to that streaming service. This all goes into an autohotkey script that calls up the appropriate streaming service and runs a URL for that channel. For example, I have assigned channel 2004 to run the Dog the Bounty Hunter on Pluto. When she enters the 2004 on her remote the script will run the appropriate URL and go through all the steps required to get it to full screen with the sound unmuted.

      And all of that works great except she has a hard time remembering what channel does what. So for her favorite channels I have set up a TriggerCMD for each so that she can say for example, "Alexa run Dog The Bounty Hunter."

      I started out with the TriggerCMD on her PC. However, she needed to say, "Alexa run Dog the Bounty Hunter on Samsung". I used the voice Samsung as her PC name because the actual name was BSB-DVR and TriggerCMD would hear other letters or words for the letters spoke. So using a full word instead of a series of letters seems to be the best way to set up your computer voice name. She found it confusing to have to say, "Alexa run Dog the Bounty Hunter on Samsung" and why not just "run Dog the Bounty Hunter."

      So to do that I needed a method of putting the voice commands central server with all of the X10 light switch commands and having the central server tell the remote HTPCs what channel to run.

      Autohotkey to the rescue. What I did was to have the autohotkey script on the server write the channel number to a configuration (.ini) file on the server. Autohotkey has some Nifty built-in functions for IniWrite and IniRead. Then on the HTPCs the autohotkey script for the television operation will read the configuration file on the server once per second looking for the channel number trigger to be other than zero. If a number is detected then the script will call up the appropriate channel number and write a zero to the server configuration file to clear the trigger.

      Here is the server command:
      {
      "trigger": "Dog the Bounty Hunter",
      "command": "C:\AHK\alexacommands.ahk 2004",
      "OffCommand": "",
      "ground": "foreground",
      "voice": "Dog the Bounty Hunter",
      "voiceReply": "OK",
      "allowParams": "true"
      }

      Here is the \server\WMC\0-Triggers.ini server configuration file:
      [Commands]
      Lenovo-PC=0
      BSB-DVR=0
      RAB-DVR=0
      server=0

      Here is the alexacommands.ahk autohotkey script on the server:
      #SingleInstance Force

      Arg1 = %1%
      Arg2 = %2%

      ;MsgBox %Arg1%***%Arg2% ;for debugging

      if (Arg1 = 2004){
      MsgBox,,, Run Dog The Bounty Hunter, 2
      IniWrite, 2004, \server\WMC\0-Triggers.ini, Commands, BSB-DVR
      ;the HTPC network name (BSB-DVR) is hard coded for the HTPC this command
      ;is intended to control.
      }
      if (Arg1 = 202){
      MsgBox,,, Run CNN, 2
      IniWrite, 202, \server\WMC\0-Triggers.ini, Commands, BSB-DVR
      }

      Here is the part of the code that checks for the trigger on the HTPCs:
      #SingleInstance Force

      PCName$ = % A_computername

      SetTimer, WinCheck, 1000

      ;Contents indicates which hotstring to jump to on startup
      IniRead, StartPage, C:\WMC\YTconfig.ini, Config, StartPage
      if (StartPage <> "none")
      {
      IniWrite, none, C:\WMC\YTconfig.ini, Config, StartPage ;reset StartPage
      gosub %StartPage%
      ;StartPage contents has the number of the channel where to start.
      }

      /* The body of the HTPC script */

      ;timer function to check for new trigger:
      WinCheck:
      Trigger$ = 0
      IniRead, Trigger$, \server\WMC\0-Triggers.ini, Commands, %PCName$%
      if (Trigger$ <> 0){
      MsgBox,,, %Trigger$%, 2
      ;reset StartPage:
      IniWrite, %Trigger$%, C:\WMC\YTconfig.ini, Config, StartPage
      ;Clear Trigger
      IniWrite, 0, \server\WMC\0-Triggers.ini, Commands, %PCName$%
      run, \server\WMC\HTPC.ahk
      }
      return

      RussR 1 Reply Last reply Reply Quote 0
      • Richard BinckleyR
        Richard Binckley
        last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • RussR
          Russ @Richard Binckley
          last edited by

          @Richard-Binckley, here's another way you could do it. You could run a tcmd command on your default computer that runs the "Dog The Bounty Hunter" command on your television computer, like this:

          tcmd --computer "RAB-DVR" --trigger "Dog The Bounty Hunter"
          

          Assuming RAB-DVR is the name of your TV computer.

          Russell VanderMey

          Richard BinckleyR 1 Reply Last reply Reply Quote 0
          • Richard BinckleyR
            Richard Binckley @Russ
            last edited by

            @Russ Thanks, I'll try that. I use the ini file for more than just for the TriggerCMD to pass other data between the PCs, so that is what I used. Is there a place where information like this is available online? All I saw was the instructions.

            RussR 1 Reply Last reply Reply Quote 0
            • RussR
              Russ @Richard Binckley
              last edited by

              @Richard-Binckley, sorry, information like what?

              Do you mean info about the tcmd utility?
              https://www.triggercmd.com/forum/topic/196/tcmd-go-command-line-tool-is-available-now

              Russell VanderMey

              1 Reply Last reply Reply Quote 0
              • Richard BinckleyR
                Richard Binckley
                last edited by Richard Binckley

                @Russ Yes, that gets the download, but I was looking for installation instructions to get it added to the recognized commands. So what I did to get it to work was to copy the tcmd-windows-amd64.exe to the C:\AHK\ folder and rename it to tcmd.exe

                Then I entered the command as this:
                C:\AHK\tcmd.exe --computer "RAB-DVR" --trigger "Dog the Bounty Hunter"

                So there must be a way to eliminate the path to the tcmd.exe and treat it like an internal or external command. I never done that manually as installers usually do it.

                But anyway I have the tcmd method working thanks.

                PS Edit:
                One other thing, I was not sure about the computer name, but after trying the "samsung" voice name, I changed it to the "RAB-DVR" network name and it worked.

                RussR 1 Reply Last reply Reply Quote 1
                • RussR
                  Russ @Richard Binckley
                  last edited by Russ

                  @Richard-Binckley, awesome. I'm glad you got that working.

                  To make it so you can run Tcmd from anywhere without including the c:\ahk path, you could copy it to c:\windows, or add c:\ahk to your PATH environment variable.

                  Here's a video on how to add a folder to your PATH:. https://youtu.be/q7PzqbKUm_4

                  Russell VanderMey

                  Richard BinckleyR 1 Reply Last reply Reply Quote 0
                  • Richard BinckleyR
                    Richard Binckley @Russ
                    last edited by

                    @Russ I have tried several different ways to be able to do this command:

                    Alexa, run Richard's Select Channel 202

                    Where:
                    On the default PC is the command Richard's Channel Select with parameters set to true
                    On \RAB-DVR PC is the command Channel Select with parameters set to true.
                    202 is the parameter I want passed to the \RAB-DVR PC.
                    Not sure if this is possible.
                    Thanks for your help.

                    RussR 1 Reply Last reply Reply Quote 0
                    • RussR
                      Russ @Richard Binckley
                      last edited by Russ

                      @Richard-Binckley, if you look at Voice Commands page, you'll see a list of voice commands. You'll see the format for the TRIGGERcmd and TRIGGER command skills (and soon the TC skill) is:

                      Alexa, ask TRIGGERcmd to run Z on Y with parameter X.

                      Or in your case, because you're using your default computer, you don't have to include the "on Y" part. You can say:

                      Alexa, ask TRIGGERcmd to run Z with parameter X.

                      Assuming your command's voice field is "Richard's Channel Select", you'd say that in place of Z, so you'd say:

                      Alexa, ask TRIGGERcmd to run Richard's Channel Select with parameter 202.

                      Alexa much more likely to match your words to your command's voice field if you change it to a single simple word like channel and say:

                      Alexa, ask TRIGGERcmd to run channel with parameter 202.

                      A more reliable way to run a command with a number parameter would be to use the TRIGGERcmd Smart Home skill, and say:

                      "Alexa, channel 50"

                      That works great, but unfortunately it's simulating a brightness percentage, so it only goes up to 100.

                      Russell VanderMey

                      Richard BinckleyR 1 Reply Last reply Reply Quote 0
                      • Richard BinckleyR
                        Richard Binckley @Russ
                        last edited by Richard Binckley

                        @Russ
                        Thanks for the reply. I've tried a couple of those and the problem is with the alexa end. Since I also have some firesticks and a fire tv DVR, alexa will be confused with some of those commands and try to run on the fire devices giving the reply, "<fire device> won't do that."

                        It appears that what I want to do is just not in the cards due to alexa software constraints, so I'm going to move on.

                        RussR 1 Reply Last reply Reply Quote 0
                        • RussR
                          Russ @Richard Binckley
                          last edited by

                          @Richard-Binckley, bummer. Sorry about that.

                          Russell VanderMey

                          Richard BinckleyR 1 Reply Last reply Reply Quote 0
                          • Richard BinckleyR
                            Richard Binckley @Russ
                            last edited by Richard Binckley

                            @Russ Well, it appears the alexa software in order to accommodate several different phrases to do specific commands, there is not much a third party can do about it. Seems like just using "Channel" or "Select Channel" will cause alexa to try to attribute te command to a fire TV device. I have run into other conflicts like trying a command "run Judy Justice" and it would try to bring up the prime TV judy justice channel on my Echo Show! Ended up using "run Barbara's Judy Justice" and it works fine.
                            Thanks again for this great software package. I have a combination of TP-Link light switches and X10 light switches and using your software allows me to alexa connect the X10 switches saving me from changing them out.

                            1 Reply Last reply Reply Quote 1
                            • D davidcook referenced this topic on
                            • First post
                              Last post