Read the statement by Michael Teeuw here.
MMM-GoogleAssistant autostart
-
@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/shBecause 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?
-
@poopyurinal the shell script cannot find the command ‘source’.
so THAT is the 1st problem
try changing line 1 to
#!/bin/bashto use bash instead of sh
I see the same problem here using sh -
Sorry for my delayed response, I didn’t have time to look into this yesterday.
Now I get:
/home/pi/testerscript.sh: line 2: /env/bin/activate: No such file or directory
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’ -
@poopyurinal I will have to work on this
-
@poopyurinal Have you looked into all closed issues on the github? https://github.com/gauravsacc/MMM-GoogleAssistant/issues/1
-
I just looked at them but am not sure of the implications of them. I was able to get my magicmirror to work with MMM-googleassistant with one command via command line:
/home/pi/env/bin/python3 -u /home/pi/MagicMirror/modules/MMM-GoogleAssistant/pi/assistant.py
Does that help make it easier to autostart in another script? Definitely beyond my abilities at this point. I definitely appreciate your continued effort!
-
@poopyurinal said in MMM-GoogleAssistant autostart:
/home/pi/env/bin/python3 -u /home/pi/MagicMirror/modules/MMM-GoogleAssistant/pi/assistant.py
so, put that command as the 1st in the little script you wrote…
and the second command starts MM… -
@poopyurinal said in MMM-GoogleAssistant autostart:
/home/pi/env/bin/python3 -u /home/pi/MagicMirror/modules/MMM-GoogleAssistant/pi/assistant.py
I put that command in the script. What was the second part about starting MM? MM is already starting automatically via pm2. With just the quoted command in the script, after reboot, the GoogleAssistant is not functional. Do I need to restart MM after running this script? What is the command to do that?
Thanks for your sustained help!
-
I should also ask, do I need a “&” after any of these commands? I’ve seen that in some tutorials, but don’t fully understand when it is needed and when it is not.
-
@poopyurinal ok, never mind on the mm…
the & at the end of a command string means, spin that command off in the background and come back… to read another command
if you do NOT have & at the end, then this command runs and all the rest wait til this command ends…
-
My script now has these contents:
#!/bin/bash
/home/pi/env/bin/python3 -u /home/pi/MagicMirror/modules/MMM-GoogleAssistant/pi/assistant.py
But the Google Assistant does not work upon boot. If I run the command:
/home/pi/env/bin/python3 -u /home/pi/MagicMirror/modules/MMM-GoogleAssistant/pi/assistant.py
after boot, from the command line, it starts. What can I do to fix this? It seems so close to working…
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login