Read the statement by Michael Teeuw here.
MMM-GoogleAssistant autostart
-
@poopyurinal sounds like assistant is ending on its own.
When u do this manually, do you have to be in the module folder?
If you run the python3 path…/assistant.py
When u are NOT in the module folder, does it work, or give an error?
-
I can run the command:
python3 /home/pi/MagicMirror/modules/MMM-GoogleAssistant/pi/assistant.py
as long as I first run:
source /env/bin/activate
It works appropriately after running those two commands. Running the top command in this post without running the bottom command results in an error.
-
@poopyurinal ok, make a two line script to execute both commands, and use that script as the exec script in the service
-
Sorry, can you go into a little more detail on that? How would I create that script?
-
@poopyurinal edit a new file, add the two lines to it, and save.
The do
chmod +x ????
Where ??? is the name of the file you just created
Then make that file name the name of the exec script.
-
Do you mean a shell script? Or a python script?
-
@poopyurinal shell script
-
In the ExecStart field of the service, what is the command I need to run before the path? My shell script is in /home/pi/testerscript.sh. What command do I need to run that?
-
@poopyurinal edit the script again and add a new 1st line
#!/bin/sh
Because it is executable, the 1st line will be checked, and if the script processor is defined, it will be used
The default is also /bin/sh
-
I edited the script as you suggested, but it is not starting after reboot. If I run it from the command line, I get:
pi@raspberrypi:~ $ /home/pi/testerscript.sh
/home/pi/testerscript.sh: 2: /home/pi/testerscript.sh: source: not found
Traceback (most recent call last):
File “/home/pi/MagicMirror/modules/MMM-GoogleAssistant/pi/assistant.py”, line 25, in
import google.oauth2.credentials
ImportError: No module named ‘google’The part after the “Traceback” is the same error I got if I tried to run the /path/to/assistant.py without first running:
source /env/bin/activate
It seems like the shell script is not running the second command within the first. If I run source /env/bin/activate, my command line is preceded by (env). Is there some way to force that within the script?