Raspberry Pi setup


  • administrators

    Log into your Raspberry Pi as user pi with password raspberry.
    sudo raspi-config
    In raspi-config, enable SSH under Advanced Options.
    Run "ifconfig | more" to find your IP address.
    From your computer, run Putty, and SSH to the IP address.

    Run these commands via Putty from your computer:
    sudo su -
    apt-get -y update
    apt-get -y upgrade
    apt-get -y install npm nodejs-legacy
    wget https://s3.amazonaws.com/triggercmdagents/triggercmdagent_1.0.1_all.deb
    dpkg -i triggercmdagent_1.0.1_all.deb
    triggercmdagent
    ( Paste in your token, and press ENTER. )
    ( Press CTRL-C to quit. )
    /usr/share/triggercmdagent/app/src/installdaemon.sh

    Now you should see your Raspberry Pi in your TRIGGERcmd account.
    Edit /root/.TRIGGERcmdData/commands.json to add or remove commands.



  • I did all the Steps and edited that TriggercmdData/commands.json but nothing happend.. I only saw that Gnome Editor and everytime I Trigger it nothing happen.... So I deleted the code of that trigger and again... NOTHING... By the way when I startup this Programm it always says no Daemon istall or something . I did that over 100000 Times but it still wont get away. My Question is : Can you give me an example Code so I can look If its all my fault , or do you know whats going on


  • administrators

    @Nelson-Ishag,

    I might know what's going on, but if you post the output when you type this command, it would help:

    /usr/share/triggercmdagent/app/src/installdaemon.sh
    

    Notice the "ground":"background" or "ground":"foreground" part of each command in the commands.json data file.

    Gnome Editor is a built-in example foreground command, but I don't think Gnome Editor is available on a Raspberry Pi, so that would explain why if you trigger it it doesn't do anything.

    I figured most people who use TRIGGERcmd on a Raspberry Pi will likely only be interested in background commands that run in the daemon (aka background service). For example "apt-get -y update".

    That said, you can run the agent in foreground mode just by running "triggercmdagent", but you'll want to run different commands than "gedit" (Gnome Editor). If you're running triggercmdagent in an SSH session, you could have it run something like "tail /var/log/messages", and if you're running it in X-Windows, you could have it run a GUI app like "xeyes".



  • @Russ - how did you get triggercmd to autostart with the raspberry pi? Is it possible at this time? I'm playing around with systemd and was curious if you knew off the top of your head if maybe it is an indicator that I didn't set it up correctly or if there was instructions or another post that showed how to autostart it bc I noticed on a few reboots the commands for waking my desktop didn't work and it was bc I had to launch triggercmd manually on my pi. Thanks man!



  • Hold up. I figured it out. So, what I ended up doing was I created my own script to run triggercmd and then I actually added a small line of code to my desktop autostart file shown below (which was kind of janky and more than likely I'd guess was he wrong way since I'm fairly new'ish with creating my own bash scripts):

    Step 1: (to create my script to run triggercmd)
    nano touch path/to/myscript.sh

    Step 2: (put inside this file then ctrl+x and "y" to exit and write to file before exiting)
    #! /bin/bash
    /usr/bin/triggercmdagent

    Step 3: (then edited my desktop autostart file)
    nano ~/.config/lxsession/LXDE-pi/autostart

    Step 4: (added this line of code in it to direct it to my file with a leading @ symbol before the path I added to the file)
    "@/path/to/myscript.sh" < - Without quotes at the bottom of the text file edited above

    Note: Figured I'd share because it likely would take somebody only a minute to do this. I don't know if maybe it was something to do with any of the dependencies or the sequence in which I had installed triggercmd with on my Pi, but I tried quite a few ways. Because I noticed when using the installdaemon.sh script- that it wasn't putting/adding a service in systemd but it was odd because it looked like the server was running when I used systemctl start/enable etc... But figured I'd share my experience and how I'd fixed it tonight. Although maybe not the best method, I wanted to share


  • administrators

    @kalen-daniel, I didn't provide a method to auto-start the triggercmdagent in the foreground on a Pi. Your method is helpful because it provides a way to do that.

    I figured most people would not run X-windows on their Pi's, like my-use case as a garages door opener. In cases like that, you'd run this script as root:

    /usr/share/triggercmdagent/app/src/installdaemon.sh
    

    ... to install the triggercmdagent as a systemd daemon that would only run background commands.

    After you run that script you can stop/start or get a status of the agent with these commands:

    systemctl stop triggercmdagent
    systemctl start triggercmdagent
    systemctl status triggercmdagent


  • This is rad -thanks Russ. I'm not sure what I did but it wouldn't let me auto-start in the foreground, but could have been a simple hiccup I made along the way, when installing it. I have my pi waking up both my laptop and desktop now and trigger can do a bunch of things with both computers from sleeping/locking/restarting them. Really cool. I'll make a better video now that I got it dialed in as it seems to be incredibly seamless with alexa and setting up a simple command in alexa UI for the virtual smartthings switches. I think stringify or smartthings or harmony needs to buy trigger off you IMO!



  • I have been trying to get this triggercmd to work on my Raspberry Pi all afternoon.

    I followed the guide above, but when I run "triggercmd", it just dumps me back to the command line with no other response.

    When I try and run: /usr/share/triggercmdagent/app/src/installdaemon.sh, I get:

    pi ~$ sudo /usr/share/triggercmdagent/app/src/installdaemon.sh
    Failed to issue method call: Unit name triggercmdagent is not valid.
    Failed to issue method call: Invalid argument
    Failed to issue method call: Unit name triggercmdagent is not valid.

    I also don't have a commands.json file under /root/.TRIGGERcmdData:

    pi ~ $ sudo ls /root/.TRIGGERcmdData -larth
    total 12K
    drwx------ 5 root root 4.0K Jul 8 14:14 ..
    drwxr-xr-x 2 root root 4.0K Jul 8 14:14 .
    -rwxr-xr-x 1 root root 220 Jul 8 16:15 triggercmdagent.service

    Any ideas?

    Thanks in advance.


  • administrators

    @jackmonkey, you should be root when you run triggercmdagent and paste in your token, so switch to root with sudo su -. Please try that and do another ls /root/.TRIGGERcmdData -larth.


Log in to reply
 

Looks like your connection to TRIGGERcmd Forum was lost, please wait while we try to reconnect.