April 23, 20206 yr Here is how to get Alexa to control your server (IE: have Alexa start up a VM / docker container etc). This is all geared towards using a free Dropbox account as the cloud server and Alexa, but the concept would be the same for any other cloud storage providers (provided you can mount the cloud storage location) and Google Assistant. You probably also need to use the same login as you would for your Alexa account. (I just used "login via google" for everything listed here, which matches my alexa account) Sign up for a free account at https://www.dropbox.com/basic From the Apps Tab, search for Dropbox and install it. You must however change the host path for the Data Files from it's default of /mnt/user/Dropbox to instead be /mnt/cache/Dropbox (dropbox will not work if it's not pointed directly at a drive), with an access mode of RW:SLAVE Start the dropbox application, and view the logs for it. In the logs there will be a line similar to Go to the URL and connect the server to your account Set Dropbox to autostart Go to https://ifttt.com/join and create a free account Go to Create Click the Plus sign Select Amazon Alexa Select Say A Specific Phrase Tell Alexa what to listen for and create the trigger Click the Plus Sign Choose Dropbox and create a text file In the box, the "content" is the command to be executed. If you're running multiple commands, then I would suggest executing them as a script ie: content would be /bin/bash /boot/my_scripts/mytestscript.sh Set the dropbox folder path to be unraid_actions Then click create action (In this example, we're just going to write "This is a test" into the syslog Using the User Scripts plugin (if already installed, then make sure that it's up to date), set up the following script to run at First Array Start Only #!/usr/bin/php <? for ( ;; ) { exec("inotifywait /mnt/cache/Dropbox/unraid_actions > /dev/null 2>&1",$out,$err); if ($err) { sleep(10); continue; } foreach (glob("/mnt/cache/Dropbox/unraid_actions/*.txt") as $file) { exec("logger ".escapeshellarg("Executing Voice Command ".file_get_contents($file))); passthru("/bin/bash ".escapeshellarg($file)); unlink($file); for ( ;; ) { sleep(1); if ( ! is_file($file) ) break; } } } ?> Enter in the following command at the terminal (If you don't do this, then it will miss the first trigger ever given) mkdir -p /mnt/cache/Dropbox/unraid_actions Reboot the server and test what you've created Quote Alexa, trigger this is a test Apr 23 08:40:27 unraidA root: Executing Voice Command logger this is a test Apr 23 08:40:27 unraidA root: this is a test Success! Now you can create any given command you want for Alexa to be able to execute on your server. IE: you can start a VM with the appropriate virsh commands, start a docker container, etc etc etc. Enjoy DANGER ZONE: DO NOT USE A DROPBOX where other people have write access to it (ie: make sure that no one else can place a file into unraid_actions). This script will execute ANY file placed into unraid_actions, and if/when your kids get annoyed at you, there is nothing stopping them from deleting the contents of your array. Only use drop box where you are in 100% complete control of. To avoid this problem, you could expand the user scripts script to actually read what's in the file (say the contents are Start VM) and then it issues the appropriate command itself. I'll leave the customization up to you guys. Something akin to #!/usr/bin/php <? for ( ;; ) { exec("inotifywait /mnt/cache/Dropbox/unraid_actions > /dev/null 2>&1",$out,$err); if ($err) { sleep(10); continue; } foreach (glob("/mnt/cache/Dropbox/unraid_actions/*.txt") as $file) { $command = trim(file_get_contents($file)); exec("logger ".escapeshellarg("Executing Voice Command $command")); switch ($command) { case "test": exec("logger this is a test"); break; case "start VM": exec("virsh....."); break; case "start plex": exec("docker start plex"); break; default: exec("logger ".escapeshellarg("unknown voice command $command")); break; } unlink($file); for ( ;; ) { sleep(1); if ( ! is_file($file) ) break; } } } ?>
April 23, 20206 yr Author Hopefully I didn't miss any steps And also, don't delete the unraid_actions folder from your dropbox. If you do this, then it will miss the first trigger given to Alexa
August 13, 20214 yr Anyone got this or a similar solution for google assistant? I got wake on lan working (asus router + ifttt + google assistant) but now I'm looking to send the unRaid server to sleep in a similar fashion.
August 13, 20214 yr Author iffft has the same applets available for Google as it does for Alexa. This was mostly a POC as I was curious (and bored)
April 24, 20224 yr Hi Squid, I actually used the "Dropbox-otherguy" mgutt's repo for this.. as i can't make the other work. I got into "Syncing..." in the container log but i don't receive my text file inside my share folder. any advise ?
April 24, 20224 yr Author This was something I did 2 years ago on a whim and have never looked at it (or used it since) Basic procedure I would think would remain the same.
April 24, 20224 yr Hi Squid, thanks. I actually tried removing the DROPBOX_SKIP_UPDATE value from the container settings. and made sure set the "Dropbox" share set to Cache setting to "No" and just tried restarting the container, and everything worked already. just circling back to share what was done to make the container work. Edit: for me this is very helpful because i don't have to do any WOL or VPN in the Server to turn on my windows VM. I can just let the kids know what to say to have the Windows VM start. thank you again for the guide. Edited April 24, 20224 yr by baby0nboardInSg
October 25, 20232 yr Thanks, still works! I'm doing the bare minimum of turning a VM on and off, but it does the trick and thankfully doesn't cost me anything (I'm subscribed to more than enough already)
November 5, 20232 yr Well that was short lived. Looks like an android/iOS button is the only way to do this with ifttt now https://ifttt.com/explore/amazon-alexa-alternatives
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.