Raspberry Pi setup
-
@Russ said in Raspberry Pi setup:
/usr/share/triggercmdagent/app/src/installdaemon.sh
I followed the steps here, but the list of commands is empty right after install. The command output is:
pi@raspberrypi:~ $ sudo triggercmdagent
Run installdaemon.sh to install the triggercmdagent daemon so it runs during boot
Daemon install: false
No token exists. Login to request one.
prompt: token: ey.........
Token saved for next time.
Tokenfile: /root/.TRIGGERcmdData/token.tkn
ComputerIDfile: /root/.TRIGGERcmdData/computerid.cfg
Logging in with saved token to run foreground tasks.
Computer ID 5eb384a2ee82630019c61bac saved for next time.
Write backup completed.
Initiated command removals
Initiated command adds|> Now connected to https://www.triggercmd.com.
___/ For help, see: http://bit.ly/2q0QDpf
(using sails.io.js node SDK @v1.1.13)
Connected at: Wed May 06 2020 20:46:43 GMT-0700 (PDT){ message: 'Subscribed to 5eb384a2ee82630019c61bac!' }
{ message: 'Subscribed to 5eb384a2ee82630019c61bac!' }
Added Gnome Editor
^C
pi@raspberrypi:~ $ sudo /usr/share/triggercmdagent/app/src/installdaemon.sh
Daemon install: true
Logging in with saved token.
Checking if the 5eb384a2ee82630019c61bac computer exists.
This computer exists in your account.
● triggercmdagent.service - TRIGGERcmd Agent
Loaded: loaded (/etc/systemd/system/triggercmdagent.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-05-06 20:35:25 PDT; 12min ago
Main PID: 864 (node)
CGroup: /system.slice/triggercmdagent.service
└─864 node /usr/share/triggercmdagent/app/src/daemon.js --run /root/.TRIGGERcmdDataMay 06 20:35:33 raspberrypi env[864]: (using sails.io.js node SDK @v1.1.13)
May 06 20:35:33 raspberrypi env[864]: Connected at: Wed May 06 2020 20:35:33 GMT-0700 (PDT)
May 06 20:35:33 raspberrypi env[864]: Initiated command removals
May 06 20:35:33 raspberrypi env[864]: { message: 'Subscribed to null!' }
May 06 20:35:33 raspberrypi env[864]: { message: 'Subscribed to null!' }
May 06 20:35:33 raspberrypi env[864]: Initiated command adds
May 06 20:35:33 raspberrypi env[864]: Failed while trying add a trigger.
May 06 20:35:33 raspberrypi env[864]: Failed while trying add a trigger.
May 06 20:35:33 raspberrypi env[864]: Failed while trying add a trigger.
May 06 20:35:33 raspberrypi env[864]: Failed while trying add a trigger.I have not edited any standard files.
-
@avs2020, it looks like you figured it out because I see commands associated with your raspberrypi computer now. Please confirm.
-
It looks like offCommand is never called using this PI/Debian distribution, do you have an update? Did you forget to include this functionality for Linux, it works fine on Windows.
-
@George-Hatzisymeon, sorry I never responded to this. I just noticed it because someone upvoted it.
I just verified that the offCommand commands.json value is supported in the current version of the Raspberry Pi agent. If you were using that version and it didn't work, then maybe you were missing this part:
"allowParams":"true"
Here's an example entry I just tested. It turns my led strip off if the parameter was off, and if the parameter was on, it turns the strip on and makes the leds green.
{ "trigger":"Green", "command":"\/root\/killrun.sh leds.py green", "offCommand": "\/root\/killrun.sh leds.py off", "ground":"background", "voice":"green", "allowParams":"true" },
-
-
-
-
-
-
-
-
What I did wrong? It appears:
E: Unable to locate package https://agents.triggercmd.com
E: Couldn't find any packageb by glob 'https://agents.triggercmd.com'
E: Couldn't find any packageb by regex 'https://agents.triggercmd.com'I'm a noob, and sorry for my english.
-
@Ar7hur, the URL to download the Raspberry Pi installer is this:
https://agents.triggercmd.com/triggercmdagent_1.0.1_all.deb
Does that answer your question?
-
@Russ I wrote this, but appears what I mentioned
-
@Ar7hur, how do you get those errors? Can you please give me the command you typed, or paste a screenshot?
-
@Russ It was my mistake. I discovered where was wrong Sorry
How to create a trigger to turn off? and is there how to turn on the pi by voice command? -
@Ar7hur, no problem. I'm glad you got it working.
You could create a trigger that runs shutdown --poweroff but it won't actually power the Raspberry Pi off. Raspberry Pi's also do not support wake-on-lan, so you couldn't power it on from another computer on your network like you could with a PC.
The only thing I can think of is you could power the Pi on/off with a relay by connecting/disconnecting the vbus on the 5volt power input with an adapter you could build with something like this, or you could use a smart plug to power it off/on. You could run a command that runs an Alexa routine that powers the smart plug on or off.
-
Hello, first of all thanks for this amazing integration/work.
I've a question:
Do you know if there's a way to add a parameter over the "commands.json" file in order to make Alexa speak when you execute the trigger? So she'll reply when you do a query. Would be great so it could be integrated with some bash scripts/ansible playbooks.
Thank you,
Kind regards. -
@Jorge-Fuentes, yes, there is a way.
You can use the Voice Reply field to do that.
This article explains how.
Basically, put "{{result}}" in your voicereply field and run the sendresult script that the TRIGGERcmd agent installs here:
Windows:
%USERPROFILE%\.TRIGGERcmdData\sendresult.bat
Linux / Mac:
~/.TRIGGERcmdData/sendresult.sh
I know you're on a Raspberry Pi, but I'm pasting the Windows GUI editor screenshot just to make sure the concept is clear.
In the runs list you can see what the "sendresult" script is sending back to the server as the "result" of the command you ran. If you include {{result]] in the Voice Reply field, The TC, TRIGGERcmd, or Trigger Command Alexa skills will say that text when you use one of those skills to trigger the command.
Instead of making the command in the commands.json file directly run the sendresult script, normally the commands.json would reference a script that would run the sendresult script last, and send back the value of an environment variable like this:
~/.TRIGGERcmdData/sendresult.sh ${RESULT}
The one problem with the above method is it uses one of the non-smart home TRIGGERcmd Alexa skills. Those skills are not as reliable at matching the words in the sentence pattern it uses to run the command. The TRIGGERcmd Smart Home Alexa skill does a much better job.
TC / TRIGGERcmd / Trigger Command Alexa skill pattern:
- Alexa, ask TRIGGERcmd to run Calculator
TRIGGERcmd Smart Home Alexa skill pattern:
- Alexa, turn on Calculator
If you want to use the TRIGGERcmd Smart Home skill to run your command, you use this method.
-
That's brilliant, thank you for the information.
-