i can't add trigger on my raspberry pi
-
Hello Russ, I managed to install the Trigger cmd on my Raspberry pi, insclusive managed to see it on the site. But I'm having trouble adding a Trigger. I could not edit the file: commands.json. I opened the terminal as root user, and typed the following code: /root/. TRIGGERcmdData/commands.json, and I received the output: Permission denied. I'd like you to help me. Thank you right now.
-
@pé-de-pano , try
nano /root/.TRIGGERcmdData/commands.json
Your command tried to execute the text file as if it was a script. Nano is a text editor.
-
@russ hello russ, I edited the commands.json to:
[
{"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":"python test","command":"python /root/led.py","ground":"background","voice":""}
]
but when saving I can't see the trigger on the site, only Gnome Editor. Could you help me? -
@pé-de-pano, can you check whether your background service is running?
systemctl status triggercmdagent
pi@garagepi:~ $ systemctl status triggercmdagent ● triggercmdagent.service - TRIGGERcmd Agent Loaded: loaded (/etc/systemd/system/triggercmdagent.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2022-03-31 10:17:03 UTC; 1 months 5 days ago Main PID: 262 (node) CGroup: /system.slice/triggercmdagent.service └─262 node /usr/share/triggercmdagent/app/src/daemon.js --run /root/.TRIGGERcmdData May 01 23:13:40 garagepi env[262]: |> Socket reconnected successfully after May 01 23:13:40 garagepi env[262]: \___/ being offline at least 28.27 seconds. May 01 23:13:40 garagepi env[262]: |> Now connected to https://www.triggercmd.com. May 01 23:13:40 garagepi env[262]: \___/ For help, see: http://bit.ly/2q0QDpf
It has to be running in order to sync up the background commands in your commands.json with your computer in your account.
-
@russ said in i can't add trigger on my raspberry pi:
hello, I received the following output● triggercmdagent.service - TRIGGERcmd Agent Loaded: loaded (/etc/systemd/system/triggercmdagent.service; enabled; vend> Active: active (running) since Fri 2022-05-06 00:28:26 BST; 1 day 12h ago Main PID: 404 (node) Tasks: 11 (limit: 1598) CPU: 3.577s CGroup: /system.slice/triggercmdagent.service └─404 node /usr/share/triggercmdagent/app/src/daemon.js --run /roo> May 07 13:09:12 raspberrypi env[404]: _-|>_- (attempt #3) May 07 13:09:12 raspberrypi env[404]: May 07 13:09:12 raspberrypi env[404]: |> Socket reconnected successfully a> May 07 13:09:12 raspberrypi env[404]: \___/ being offline at least 132038.91 > May 07 13:09:12 raspberrypi env[404]: |> Now connected to https://www.trig> May 07 13:09:12 raspberrypi env[404]: \___/ For help, see: http://bit.ly/2q0Q> May 07 13:09:12 raspberrypi env[404]: (using sails.io.js node SDK @v1.1> May 07 13:09:12 raspberrypi env[404]: Connected at: Sat May 07 2022 13> May 07 13:09:12 raspberrypi env[404]: { message: 'Subscribed to null!' } May 07 13:09:12 raspberrypi env[404]: { message: 'Subscribed to null!' } ~ ~ ~ lines 1-19/19 (END)...skipping... ● triggercmdagent.service - TRIGGERcmd Agent Loaded: loaded (/etc/systemd/system/triggercmdagent.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2022-05-06 00:28:26 BST; 1 day 12h ago Main PID: 404 (node) Tasks: 11 (limit: 1598) CPU: 3.577s CGroup: /system.slice/triggercmdagent.service └─404 node /usr/share/triggercmdagent/app/src/daemon.js --run /root/.TRIGGERcmdData May 07 13:09:12 raspberrypi env[404]: _-|>_- (attempt #3) May 07 13:09:12 raspberrypi env[404]: May 07 13:09:12 raspberrypi env[404]: |> Socket reconnected successfully after May 07 13:09:12 raspberrypi env[404]: \___/ being offline at least 132038.91 seconds. May 07 13:09:12 raspberrypi env[404]: |> Now connected to https://www.triggercmd.com. May 07 13:09:12 raspberrypi env[404]: \___/ For help, see: http://bit.ly/2q0QDpf May 07 13:09:12 raspberrypi env[404]: (using sails.io.js node SDK @v1.1.13) May 07 13:09:12 raspberrypi env[404]: Connected at: Sat May 07 2022 13:09:12 GMT+0100 (British Summer Time) May 07 13:09:12 raspberrypi env[404]: { message: 'Subscribed to null!' } May 07 13:09:12 raspberrypi env[404]: { message: 'Subscribed to null!' }
-
@pé-de-pano, I see this in your output:
"Subscribed to null!"
That's bad. It should not be "null". It should be your computer ID.
I suggest you try this:
- Delete your computer from your account
- Login as root with this command: sudo su -
- Run triggercmdagent
- Re-enter your token.
- Press CTRL-C to exit.
- Run: systemctl restart triggercmdagent
- Run: systemctl status triggercmdagent
It should re-create your computer in your account, with the commands in your commands.json file.
-
It all worked out! Thank you very much Russ, you helped me a lot.@russ