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

    I can't create triggers on the raspberry pi

    Raspberry Pi
    3
    12
    1.5k
    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.
    • RussR
      Russ @Celso Santos
      last edited by Russ

      @Celso-Santos, in your output I see, "No token exists. Login to request one."

      I think you probably entered your token while logged in as your pi (not root) user.

      The instructions here start with the sudo su - command to switch to root.

      You'll probably need to delete your computer in your account (because it's associated with your pi user), and run triggercmdagent while logged in as root so you can re-enter a token and re-create the computer in your account.

      Russell VanderMey

      Celso SantosC 1 Reply Last reply Reply Quote 0
      • Celso SantosC
        Celso Santos @Russ
        last edited by

        @Russ Thanks for the tip!
        I removed the triggerCMD and performed a new installation using the root user.
        Initially, he had problems when I made changes to the commands.json file using nano.
        Using the ne everything went well.

        1 Reply Last reply Reply Quote 0
        • tuicemenT tuicemen moved this topic from Instructions on
        • Dean McNaughtonD
          Dean McNaughton
          last edited by

          Love the app. Great work you're doing! Works like a charm on my mac and PC.

          Having problems getting commands to run in the foreground on RPi4. Wondering if you can spot a quick reason.

          I've installed the triggercmdagent as root. It's in my list of computers. Triggers get sent and I can see they are "ran" with a triggercmdagent instance open in PuTTy.

          The specific command I'm trying to run is one I added to the /root/.TRIGGERCmdData/commands-.json file, as follows:

          {"trigger":"calculator","command":"galculator","ground":"foreground","voice":"calculator","allowParams": "false"}

          With this command, I'd expect to see the calculator open in the foreground, but nothing visible happens on the screen, despite triggercmdagent indicating it ran via PuTTy.

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

            @dean-mcnaughton

            Weird. I made some edits (can't retrace my steps) and the calculator started working. Now having the same problem trying to make another foreground command using "chromium-browser" as the command.

            So, to summarize, with the following commads.json file:

            [
            {"trigger":"Reboot","command":"shutdown -r","ground":"background","voice":"reboot","allowParams": "false"},
            {"trigger":"Gnome Editor","command":"gedit","ground":"foreground","voice":"edit","allowParams": "false"},
            {"trigger":"yum update","command":"yum -y update","ground":"background","voice":"yum update","allowParams": "false"},
            {"trigger":"apt update","command":"apt-get -y update","ground":"background","voice":"update","allowParams": "false"},
            {"trigger":"calculator","command":"galculator","ground":"foreground","voice":"calculator","allowParams": "false"},
            {"trigger":"chromium","command":"chromium-browser","ground":"foreground","voice":"chromium","allowParams": "false"}
            ]

            Calculator: works
            Gnome: does not work
            Chromium: does not work

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

              @dean-mcnaughton

              To summarize, with the following commands.json file:

              [
              {"trigger":"Reboot","command":"shutdown -r","ground":"background","voice":"reboot","allowParams": "false"},
              {"trigger":"Gnome Editor","command":"gedit","ground":"foreground","voice":"edit","allowParams": "false"},
              {"trigger":"yum update","command":"yum -y update","ground":"background","voice":"yum update","allowParams": "false"},
              {"trigger":"apt update","command":"apt-get -y update","ground":"background","voice":"update","allowParams": "false"},
              {"trigger":"calculator","command":"galculator","ground":"foreground","voice":"calculator","allowParams": "false"},
              {"trigger":"chromium","command":"chromium-browser","ground":"foreground","voice":"chromium","allowParams": "false"}
              ]

              Calculator works
              Gnome does not work
              Chromium does not work

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

                @dean-mcnaughton, I think you're running into the problems we worked through in this post.

                You might need to specify the full path to the command.

                If the agent is running as root in background mode, you'll need to make your commands have ground = background.

                Also your Xwindows is running as your user (pi by default), so you'll want to run this command as your user to allow root to display Xwindows apps in your user's Xwindows:

                xhost +
                

                Also, your command should run a script that includes this before the app runs. This will tell it to display the app on in user's Xwindows:

                export DISPLAY=:0.0
                

                Or, if your agent is running in forground mode as your user (probably pi), could you try something like this to open Chromium?

                {"trigger":"myTriggerName","command":"xdg-open https://google.com","ground":"foreground","voice":"myTriggerName","allowParams":"false"}
                

                Russell VanderMey

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

                  @russ

                  Thank you for the recommendations! Still no success. 😞

                  1. Regarding the full path:

                  Should have mentioned I did try the full path and it did not work. It was structured as follows:

                  {"trigger":"chromium","command":"/usr/share/applications/chromium-browser.desktop","ground":"foreground","voice":"chromium","allowParams": "false"}
                  

                  2. Regarding the url link:
                  I also tried your suggestion to use the xdg-open command with the url. It did not work.

                  3. Regarding X-windows
                  I am curious about the X-windows advice; I have no experience with X-windows, but did read over your original "Raspberry Pi Setup" post and noticed you discussed it there, then read a little more on it, but still really don't understand what it is. I use PuTTy to ssh and VNC Viewer to view. My ignorance on X-windows could be the root of the problem. Not sure.

                  4. Regarding xhost +

                  Continuing from #3 (above), I thought... "Maybe X-windows is running and I don't even know it. So, I'll just try the xhost + commands." Those results are as follows:

                  4a. Entering xhost from PuTTy:
                  When entering xhost + as user in PuTTy this is the response:

                  pi@raspberrypi:~ $ xhost +
                  xhost:  unable to open display ""
                  

                  4a. Entering xhost from Terminal on RPi:
                  When entering xhost + as user in terminal on the RPi, this is the response:

                  pi@raspberrypi:~ $ xhost +
                  access control disabled, clients can connect from any host
                  

                  I really do appreciate the help you've given, and any other quick thoughts you might have. Also don't want to waste too much of your time, so please don't feel too compelled to solve my problems. They are... my problems. 🙂

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

                    @russ
                    I'm going a different route... replacing Raspian with Ubuntu. There are other programs that may work better with that OS as well.

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

                      After a brief foray with Ubuntu, I'm back to Raspberry Pi OS.

                      Attempted a Raspberry Pi OS installation loaded with triggercmd, using the method described here: Windows script to prep SD card for Raspberry Pi with TRIGGERcmd agent. But it didn't get past the boot screen.

                      So, reinstalled triggercmdagent from scratch using original instructions here: Raspberry Pi setup.

                      Followed those instructions verbatim and triggers still aren't working. In fact, the calculator trigger doesn't work anymore.

                      I'm stumped.

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

                        I've got this working now.

                        Instead of installing using the instructions at "Raspberry Pi Setup", I went to the "Instructions" page and downloaded the deb file and token there. The deb installed the agent to /usr/share/triggercmdagent and the .TRIGGERcmdData folder was placed in /home/pi. Now I can add/edit the commands.json file inside the .TRIGGERcmdData folder and everything works as it should.

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

                          @dean-mcnaughton, nice. Good job getting it working.

                          Russell VanderMey

                          1 Reply Last reply Reply Quote 0
                          • RussR Russ referenced this topic on
                          • First post
                            Last post