Thanks @Xander. I'm glad that worked.
-
RE: New Computer Alexa doesnt work
@Russ Yes, just the .json into a clean install. Seemed safest.
I've un/reconnected the Triggercmd Smart home skill. It re-found the triggers on my less-used other computer but nothing from the new one. After some fiddling, it finally kicked in - I think setting a voice name finally did it.
It was just Alexa -- "triggers work on the PC and from the dashboard here" (this site)
Banana set to run notepad was added into Alexa within seconds. Which got me thinking and what I did was Cut out all my content from my .json, saved, ensure that the triggers disappeared from the Alexa app, repasted them back in, saved, and they all showed up ... AND WORKED.
Thanks for your help.
Saying "good night" to Alexa and having her turn off my monitors (smart plug) and hibernate the PC (trigger) is a big part of my routine. -
RE: New Computer Alexa doesnt work
Sorry about this @Xander. Do you even see the devices in the Alexa device list? Also have you tried unlinking and relinking the TRIGGERcmd Smart Home skill?
Please try changing one of your commands or make a new one with voice word banana. Alexa always recognizes it, and I doubt you're currently using that.
Also please confirm you can run your commands from the website, so it's just the Alexa skill that isn't working.
You said you copied everything over. What did you copy? If you copied your whole .TRIGGERcmdData folder the new computer should have taken the same computer ID and you wouldn't have to change anything, so I suspect you copied just your commands.json file over?
-
RE: New Computer Alexa doesnt work
@Russ Been trying that since last night and now the Alexa app won't rediscover them at all now, "organically" or even when I try to force detection.
-
RE: New Computer Alexa doesnt work
@Xander, one thing to try is rename the computer because that should delete and recreate the Alexa devices. If that doesn't work, please try renaming one of your commands and see if that command works via Alexa.
-
RE: New Computer Alexa doesnt work
@Russ Necroposting as this is pretty much on target for me. Replaced my old computer with a newer one, copied everything over ... triggers work on the PC and from the dashboard here. I've made the new one the default and even deleted the old one but the devices in Alexa aren't triggering. I thought I might need to delete them and let them be rediscovered so I tried that and the newly-discovered ones aren't working.
I'm scratching my head here.
-
RE: How to create a trigger
@gigaboy, thanks for sharing that link. I'm loving the fact that Google gave you that answer - to use TRIGGERcmd via IFTTT.
If your server doesn't have a GUI, you'll have to edit your ~/.TRIGGERcmdData/commands.json file manually, using a text editor like vi (aka vim) or pico, nano etc.
On Linux, your default ~/.TRIGGERcmdData/commands.json file includes the first 5 commands. I added the 6th command you could use to restart mysql, like Google says.
[ {"trigger":"Reboot","command":"shutdown -r","ground":"background","voice":"reboot","allowParams": "false"}, {"trigger":"Gnome Editor","command":"gedit","ground":"foreground","voice":"notepad","allowParams": "false"}, {"trigger":"Calculator","command":"gnome-calculator","ground":"foreground","voice":"calculator","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": "Restart MySQL", "command": "sudo systemctl restart mysql", "offCommand": "", "ground": "background", "voice": "restart", "voiceReply": "", "allowParams": "false" } ]
Notice I made "ground" = "background" because without a GUI, you probably installed the background agent (with installdaemon.sh) which runs the TRIGGERcmd agent in background mode as service.
-
RE: Ubuntu 22 - Installation throws permission denied, no prompt for token
@gigaboy the errors you see here:
Computer name for Local Home Assistant listener: null Error fetching computer name: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received null at Object.writeFile (node:fs:2311:5) at /usr/lib/triggercmdagent/resources/app/src/ha.js:120:10 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { code: 'ERR_INVALID_ARG_TYPE' }
Those errors are actually what I want to fix in the next version of the agent. The errors are related to the new Home Assistant integration. It errors like that on first run because it can't fetch the computer name. If you don't use Home Assistant you can ignore it, and if you do, just restart the agent.
Anyway, to solve your problem, please try this:
systemctl restart triggercmdagent
Then check the status again with this:
systemctl status triggercmdagent
That will restart it and if it can find node 20, it should work. It just has to be above node 12, so 16 could work too.
Let me know how goes please. Also, what method did you use the install nodejs? nvm or apt?
-
RE: Ubuntu 22 - Installation throws permission denied, no prompt for token
@gigaboy, you're welcome. I found a separate problem I'd like to solve in a new version, but since then I also found the specific problem you ran into.
I found the latest version of the triggercmd agent doesn't work with node version 12, and node version 12 gets installed by default on ubuntu 22 when you install nodejs. It worked fine for me on my ubuntu 24 because it installed node version 18 when I ran apt install nodejs.
On your ubuntu 22 you could use nvm (node version manager) to install node version 16 (or greater) like this:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion nvm install 16
In case it got bad data from a previous failed run, you should delete your ~/.TRIGGERcmdData folder like this:
rm -rf ~/.TRIGGERcmdData
Then run the agent again like this:
node /usr/lib/triggercmdagent/resources/app/src/agent.js --console
I like the flexibility of nvm, but here's another option for installing nodejs version 16:
apt remove nodejs -y curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - apt install -y nodejs
Thank you for reporting your issue btw, and thank you for your patience.
-
RE: Ubuntu 22 - Installation throws permission denied, no prompt for token
@gigaboy, looking into this now.
EDIT: @gigaboy , I re-read your post. I see you're trying to use the agent on a server without X-Windows. I just tried that and I see I need to fix some things so give me some time to produce a new version.