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

    Help with Home Assistant Command

    Instructions
    2
    8
    784
    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.
    • Dean McNaughtonD
      Dean McNaughton
      last edited by Dean McNaughton

      Re: How to run commands from Home Assistant

      I've inserted this line into my Home Assistant config.yaml file (below), and it does not appear to be running the command at all. The triggercmd agent, running in terminal, doesn't indicate any command is received / executed. I suspect the problem is in the payload line. Of course my actual token is inserted where it should be, indicated by MYTOKEN in the script below.

      The title of my trigger, in TRIGGERcmd is "calculator", and it does work, when executed via TRIGGERcmd.

      Any suggestions what I've done wrong here:

      rest_command:
        triggercmd_calculator:
          url: 'https://www.triggercmd.com/api/run/triggerSave'
          method: "post"
          content_type: "application/x-www-form-urlencoded"
          payload: "trigger=calculator&token=(MYTOKEN)"
      
      RussR 1 Reply Last reply Reply Quote 0
      • RussR
        Russ @Dean McNaughton
        last edited by

        @dean-mcnaughton ,

        I think all you need to do is include one more parameter in your payload line:

        payload: "computer=(MYCOMPUTER)&trigger=calculator&token=(MYTOKEN)"
        

        Russell VanderMey

        Dean McNaughtonD 1 Reply Last reply Reply Quote 0
        • Dean McNaughtonD
          Dean McNaughton @Russ
          last edited by Dean McNaughton

          @russ

          Still not working. I tried it with and without a parenthesis around the trigger word - calculator (see below). Neither work.

          It looks like the triggercmdagent never gets the order to run; when I review the run count for the trigger, it never changes after I call the service in Home Assistant.

          I've confirmed I'm using the same token that's on file at the DAM-UBUVM computer. Do you have any other thoughts?

          Tried with parenthesis, as follows:

          rest_command:
            triggercmd_calculator:
              url: 'https://www.triggercmd.com/api/run/triggerSave'
              method: "post"
              content_type: "application/x-www-form-urlencoded"
              payload: "computer=(DAM-UBUVM)&trigger=(calculator)&token=(MYTOKEN)"
          

          Tried without parenthesis, as follows:

          rest_command:
            triggercmd_calculator:
              url: 'https://www.triggercmd.com/api/run/triggerSave'
              method: "post"
              content_type: "application/x-www-form-urlencoded"
              payload: "computer=(DAM-UBUVM)&trigger=calculator&token=(MYTOKEN)"
          
          RussR 1 Reply Last reply Reply Quote 0
          • RussR
            Russ @Dean McNaughton
            last edited by Russ

            @dean-mcnaughton, sorry I wasn't clear. Parenthesis are not necessary. I think either of these should work:

            rest_command:
              triggercmd_calculator:
                url: 'https://www.triggercmd.com/api/run/triggerSave'
                method: "post"
                content_type: "application/x-www-form-urlencoded"
                payload: "computer=laptop&trigger=calculator&token=xyz....abc"
            
            rest_command:
              triggercmd_calculator:
                url: 'https://www.triggercmd.com/api/run/triggerSave?computer=laptop&trigger=calculator&token=xyz....abc'
                method: "get"
                content_type: "application/x-www-form-urlencoded"
            

            Also, the token can come from the token.tkn file on your computer or the Instructions page - either should work.

            You could also test with curl like this:

            curl "https://www.triggercmd.com/api/run/triggerSave?computer=laptop&trigger=calculator&token=asdf"
            

            Russell VanderMey

            Dean McNaughtonD 1 Reply Last reply Reply Quote 0
            • Dean McNaughtonD
              Dean McNaughton @Russ
              last edited by

              @russ

              Thank u! It is working now. Using the post method, this was the payload line that ended up working (no parenthesis were used):

              payload: "computer=DAM-UBUVM&trigger=calculator&token=MYTOKEN"

              RussR 1 Reply Last reply Reply Quote 1
              • RussR
                Russ @Dean McNaughton
                last edited by

                @dean-mcnaughton, awesome. Nice job.

                Russell VanderMey

                Dean McNaughtonD 1 Reply Last reply Reply Quote 0
                • Dean McNaughtonD
                  Dean McNaughton @Russ
                  last edited by Dean McNaughton

                  @russ
                  Thanks. Really loving this app.

                  In case you're interested, the final application was to automate arming/disarming a home security system for when people arrive or leave the home.

                  My particular vendor (A-tech security) does not allow integration with home automation systems, like Home Assistant (HA) or SmartThings, but they do allow users to log into their account online to arm/disarm their system.

                  So, this was the workaround:

                  1. Home Assistant presence sensor with an on/off boolean (toggle) sends command to TRIGGERcmd as follows:
                    • HA present (toggle on) --> TRIGGERcmd to arm
                    • HA away (toggle off) --> TRIGGERcmd to disarm
                  2. UI.Vision web extension configured on an always on VM receives the appropriate trigger, from TRIGGERcmd.
                    • An arm trigger executes a UI.Vision autorun html file that logs in and arms the system.
                    • A disarm trigger executes a UI.Vision autorun html file that logs in and disarms the system.
                  RussR 1 Reply Last reply Reply Quote 0
                  • RussR
                    Russ @Dean McNaughton
                    last edited by

                    @dean-mcnaughton, that's awesome! I'm always interested in use-cases like this. Thanks for sharing.

                    Russell VanderMey

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post