Sorry, can you go into a little more detail on that? How would I create that script?
Read the statement by Michael Teeuw here.
Best posts made by poopyurinal
-
RE: MMM-GoogleAssistant autostart
Latest posts made by poopyurinal
-
RE: Using MMM-Buttons and MMM-Remote-Control to toggle module on and off with short press
@sdetweil thanks for your quick reply. In the end it was actually fairly simple, and I think I was overthinking it. I had to change the “payload” line to:
payload: {action: “TOGGLE”, module: “MMM-BackgroundSlideshow”}
That got me the expected behavior, with the first button press turning the slideshow on, and another button press turning the slideshow off.
Thank you for your help!
-
Using MMM-Buttons and MMM-Remote-Control to toggle module on and off with short press
Hi everyone, I am trying to get a few modules to play nicely together but the configuration is beyond my abilities. I’ve tried searching similar problems but have not been able to get it working, and ChatGPT was unable to help :-) I would appreciate any suggestions. I have MMM-Buttons, MMM-Remote-Control and MMM-BackgroundSlideshow (among others) installed and working normally. My congif.js for the relevant modules is below:
{ module: 'MMM-Remote-Control', // uncomment the following line to show the URL of the remote control on the mirror // position: 'bottom_left', // you can hide this module afterwards from the remote control itself config: { customCommand: {}, // Optional, See "Using Custom Commands" below showModuleApiMenu: true, // Optional, Enable the Module Controls menu secureEndpoints: true, // Optional, See API/README.md // uncomment any of the lines below if you're gonna use it // customMenu: "custom_menu.json", // Optional, See "Custom Menu Items" below // apiKey: "", // Optional, See API/README.md for details // classes: {} // Optional, See "Custom Classes" below } }, { module: 'MMM-Buttons', config: { buttons: [ { pin: 24, name: "monitor_control", longPress: { notification: "REMOTE_ACTION", payload: {action: "SHUTDOWN"} }, shortPress: { notification: "REMOTE_ACTION", payload: {action: "REBOOT"} } }, ] } }, { module: 'MMM-BackgroundSlideshow', position: 'fullscreen_above', config: { imagePaths: ['modules/MMM-BackgroundSlideshow/exampleImages/'], transitionImages: true, randomizeImageOrder: true } },
The button itself is working as configured, via short and long presses, but I would like to change the short press to toggle the MMM-BackgroundSlideshow module to turn on and off. Unfortunately, despite LOTS of great documentation, it is beyond my abilities. I would appreciate any and all suggestions! Thanks!
-
RE: MMM-GoogleAssistant autostart
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…
-
RE: MMM-GoogleAssistant autostart
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.
-
RE: MMM-GoogleAssistant autostart
@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!
-
RE: MMM-GoogleAssistant autostart
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!
-
RE: MMM-GoogleAssistant autostart
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’ -
RE: MMM-GoogleAssistant autostart
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?
-
RE: MMM-GoogleAssistant autostart
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?
-
RE: MMM-GoogleAssistant autostart
Do you mean a shell script? Or a python script?