There are three significant changes in myenv (http://ContextKnowledgeSystems.org/download/myenv.zip)
- $USER is used for userid. The only place that may cause a problem is wslhome, because the Linux userid need not be the same as the Windows userid. You can fix this problem by putting a modified wslhome command in $HOME/bin.
- wslhome uses the latest location (obtained from How-To Geek). The path is established in several steps corresponding to the locations where the command may fail because of permissions. You will have to use the Windows security tab to give yourself permission to access your WSL home directory. If you are not using Ubuntu, you need to change “*Ubuntu*” to match your choice of Linux systems. Remember to treat the Linux files as read-only.
- A machome command and MHOME environment variable are added to accommodate macOS, which uses “/Users/userid” instead of “/home/userid”. The mkzip command is changed to use $HOME/tmp because macOS links /tmp to /private/tmp.
For my first try I chose to implement a simple “missing” Alexa command: Restart Fire TV Stick. Amazon Fire TV Stick, like every Android program, is prone to losing its internet connection while still connected to WiFi. The only way to restore the internet connection is to restart the program. Restart has two steps: turn off power; turn on power.
An Alexa routine consists of a trigger phrase, a list of action phrases and an Alexa device name. It is stored with all other Alexa information at http://alexa.amazon.com. To define and/or edit a routine you must use the Amazon Alexa app on an Android phone or iPhone. You can choose your own trigger phrase, but you have to test whether Alexa can distinguish it from other valid phrases. Each action phrase is chosen from a fixed list of alternatives.
This is my intended restart routine:
Alexa, Restart Fire TV Stick
Turn Off rhmFireTV
Turn On rhmFireTV
The device you speak to
When I execute the Amazon Alexa app on my Android phone, it enables Routines and checks the validity of my mobile phone number. I then select the Routines menu and enter my new routine. But I find that rhmFireTV is not an allowed object for an action — it is not a Smart Home device. Fortunately, I have a TP-Link mini smart plug. I change its name to “Fire TV power”, and use that name instead of rhmFireTV. I check my routine and discover that the editor has changed the order of my actions. I press the six dots and slide my second action to the bottom of the list. I click CREATE to record my new routine at http://alexa.amazon.com, wait a minute, and test my new routine:
Alexa, Restart Fire TV Stick
and Alexa responds
Sorry, I am unable to restart the book right now.
I make a good guess: I change the trigger phrase to “Restart” and Alexa executes my routine. But my second action does not work; I need a delay before turning the power back on. I insert an Alexa Says action: “Au revoir!”. I test again, and it works as intended!
Alexa Routines are still in an early stage of development. I expect that future changes will make Routines into a powerful, useful tool.
Windows 10 can run two Linux subsystems simultaneously: Cygwin and Ubuntu. I developed a small package of commands (myenv.zip) to conveniently access files from all three operating systems. It creates five environment variables
myOS — Cygwin or GNU/Linux
myDRIVE — install drive of Windows 10
WHOME — Windows home directory
CHOME — Cygwin home directory
LHOME — Ubuntu home directory
Just add “. myenv” to your .profile and you can access files like this:
$WHOME/OneDrive (Microsoft cloud store)
$CHOME/KE/bin/ke.exe (my Knowledge Explorer)
$LHOME/../../rootfs/etc/shadow (to delete forgotten password)
There’s one caveat: Microsoft has a complex scheme for buffering $LHOME (Windows file system) and $HOME (Ubuntu file system). Don’t try to access $LHOME until you exit the Ubuntu terminal window.
The myenv package includes three other useful commands:
path — prints each $PATH directory on separate line
wordpad — example command not found in $PATH directory
mkzip — zip all files in directory and its subdirectories
To install the free myenv package, download http://ContextKnowledgeSystems.org/download/myenv.zip and unzip in any directory in $PATH. I suggest using directory $myDRIVE/bin or /usr/local/bin or $HOME/bin.
Context Knowledge Blogs will focus on:
high quality free software
modifying software to match your personal context
interactive AI systems such as Amazon Alexa, Apple Siri, Google Assistant, Microsoft Cortana
available knowledge bases such as OpenCyc, SUMO, DBpedia, WordNet