@sdetweil
That worked! Thanks much for the quick reply and the fix.
Being a noob, I probably wouldn’t understand the answer, but why did my basic installation work?
@sdetweil
That worked! Thanks much for the quick reply and the fix.
Being a noob, I probably wouldn’t understand the answer, but why did my basic installation work?
I’ve been fighting this issue for several days with a new installation. MMM with Hello-Lucy starts up normally, with several modules displayed. I trigger with HELLO LUCY, then say SHOW PAGE TWO (or any other page I have configured), I hear the “ding”, and I get a blank page. Even with SHOW PAGE ONE, I get a blank page. From there, only SHOW MODULES get me back to an active display.
Here’s what I get from the dev console. The error shown comes from saying SHOW PAGE TWO.
main.js:481 Initializing MagicMirror.
translator.js:128 Loading core translation file: translations/en.json
translator.js:146 Loading core translation fallback file: translations/en.json
loader.js:184 Load script: modules/Hello-Lucy/Hello-Lucy.js
module.js:509 Module registered: Hello-Lucy
loader.js:155 Bootstrapping module: Hello-Lucy
loader.js:160 Scripts loaded for: Hello-Lucy
loader.js:203 Load stylesheet: vendor/css/font-awesome.css
loader.js:203 Load stylesheet: modules/Hello-Lucy/Hello-Lucy.css
loader.js:162 Styles loaded for: Hello-Lucy
translator.js:107 Hello-Lucy - Load translationfalse: translations/en.json
VM4 sandbox_bundle:53 Electron Security Warning (Insecure Content-Security-Policy) This renderer process has either no Content Security
Policy set or a policy with "unsafe-eval" enabled. This exposes users of
this app to unnecessary security risks.
For more information and help, consult
https://electronjs.org/docs/tutorial/security.
This warning will not show up
once the app is packaged.
warnAboutInsecureCSP @ VM4 sandbox_bundle:53
loader.js:164 Translations loaded for: Hello-Lucy
loader.js:184 Load script: modules/MMM-EasyPix/MMM-EasyPix.js
module.js:509 Module registered: MMM-EasyPix
loader.js:155 Bootstrapping module: MMM-EasyPix
loader.js:160 Scripts loaded for: MMM-EasyPix
loader.js:203 Load stylesheet: modules/MMM-EasyPix/MMM-EasyPix.css
loader.js:162 Styles loaded for: MMM-EasyPix
loader.js:164 Translations loaded for: MMM-EasyPix
loader.js:184 Load script: modules/default/weather/weather.js
module.js:509 Module registered: weather
loader.js:155 Bootstrapping module: weather
loader.js:184 Load script: vendor/node_modules/moment/min/moment-with-locales.js
loader.js:184 Load script: modules/default/weather/weatherprovider.js
loader.js:184 Load script: modules/default/weather/weatherobject.js
loader.js:184 Load script: vendor/node_modules/suncalc/suncalc.js
loader.js:184 Load script: modules/default/weather/providers/openweathermap.js
loader.js:160 Scripts loaded for: weather
loader.js:244 File already loaded: font-awesome.css
loader.js:203 Load stylesheet: vendor/node_modules/weathericons/css/weather-icons.css
loader.js:203 Load stylesheet: modules/default/weather/weather.css
loader.js:162 Styles loaded for: weather
loader.js:164 Translations loaded for: weather
loader.js:184 Load script: modules/default/calendar/calendar.js
module.js:501 Check MagicMirror version for module 'calendar' - Minimum version: 2.1.0 - Current version: 2.18.0
module.js:503 Version is ok!
module.js:509 Module registered: calendar
loader.js:155 Bootstrapping module: calendar
loader.js:244 File already loaded: moment.js
loader.js:160 Scripts loaded for: calendar
loader.js:203 Load stylesheet: modules/default/calendar/calendar.css
loader.js:244 File already loaded: font-awesome.css
loader.js:162 Styles loaded for: calendar
loader.js:164 Translations loaded for: calendar
loader.js:203 Load stylesheet: css/custom.css
weatherprovider.js:35 Weather provider: OpenWeatherMap initialized.
weatherprovider.js:46 Weather provider: OpenWeatherMap started.
calendar.js:87 Starting module: calendar
main.js:499 All modules started!
module.js:202 MMM-EasyPix is resumed.
module.js:202 weather is resumed.
module.js:202 calendar is resumed.
weather.js:149 New weather information available.
Hello-Lucy.js:262 Uncaught TypeError: Cannot read properties of undefined (reading 'speed')
at Hello-Lucy.js:262
at main.js:456
at Array.map (<anonymous>)
at Array.enumerate (main.js:455)
at Class.socketNotificationReceived (Hello-Lucy.js:259)
at module.js:245
at Socket.<anonymous> (socketclient.js:38)
at Socket.Emitter.emit (index.js:143)
at Socket.emitEvent (socket.js:276)
at Socket.onevent (socket.js:263)
(anonymous) @ Hello-Lucy.js:262
(anonymous) @ main.js:456
enumerate @ main.js:455
socketNotificationReceived @ Hello-Lucy.js:259
(anonymous) @ module.js:245
(anonymous) @ socketclient.js:38
Emitter.emit @ index.js:143
emitEvent @ socket.js:276
onevent @ socket.js:263
MMSocket.socket.onevent @ socketclient.js:32
onpacket @ socket.js:228
Emitter.emit @ index.js:143
ondecoded @ manager.js:200
Emitter.emit @ index.js:143
add @ index.js:110
ondata @ manager.js:192
Emitter.emit @ index.js:143
onPacket @ socket.js:323
Emitter.emit @ index.js:143
onPacket @ transport.js:100
onData @ transport.js:92
ws.onmessage @ websocket.js:76
module.js:195 Hello-Lucy is suspended.
module.js:195 MMM-EasyPix is suspended.
module.js:195 weather is suspended.
module.js:195 calendar is suspended.
Well, I gave up on the Adafruit Voice Bonnet, and instead installed a USB microphone with output (Samson GoMic). Now, mic and speakers work every time whether MM/Hello-Lucy starts up automatically at boot, or if I start it using npm start.
I’ll probably mark it resolved, even thought the fundamental issue is not.
A BIG thanks to @sdetweil for all of his patience and help.
Just sent two additional files; one where the speaker worked, and one where it didn’t. As I explained in the email, this is an intermittent issue and it doesn’t matter how MM is started.
@sdetweil
Let me start by saying I really appreciate your help with this. You’ve given me a lot of your time, and clearly I couldn’t have made any progress without you. Thank you.
Running your fixupppm2 script fixes the microphone on a restart, but then there is no speaker output. If I stop MM, then manually restart it with npm start, the mic and speaker work fine, as before the fixup.
@sdetweil
I followed the instructions from https://www.magicmirrorcentral.com/complete-raspberry-pi-magic-mirror-tutorial/.
It included
type in the following command:
pm2 startup
A different command will appear. Run that command also.
Now create a shell script for startup. Open up the built-in text editor on the Pi by typing in:
cd ~
nano mm.sh
The lower line basically means, “open up a file called mm.sh in the nano text editor.”
When the text editor has opened, add this to the mm.sh file:
cd ~/MagicMirror
DISPLAY=:0 npm start
Make your shiny new script executable by typing in:
chmod +x mm.sh
Now start up Magic Mirror and make it start up on boot:
pm2 start mm.sh
pm2 save
Now, reboot your Pi by typing in
sudo reboot
The difference is how MM is started. If I do it the manual way, the microphone works (with or without debug enabled). If MM does its normal autostart, using mm.sh that includes DISPLAY=:0 npm start, then the microphone doesn’t work.
@sdetweil
WELL, now it seems to work. Running from command line w/ debug, I don’t get microphone with ERROR, and if I say “Hello Lucy”, it prompts for a command, then does it, and issues the “ding”. I’ve done this three times now, and its worked every time. Here’s the debug outout:
> magicmirror@2.18.0 start /home/pi/MagicMirror
> DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js
[05.01.2022 11:55.24.384] [LOG] Starting MagicMirror: v2.18.0
[05.01.2022 11:55.24.394] [LOG] Loading config ...
[05.01.2022 11:55.24.404] [LOG] Loading module helpers ...
[05.01.2022 11:55.26.860] [LOG] Initializing new module helper ...
[05.01.2022 11:55.26.864] [LOG] Module helper loaded: Hello-Lucy
[05.01.2022 11:55.26.866] [LOG] All module helpers loaded.
[05.01.2022 11:55.27.040] [LOG] Starting server on port 8081 ...
[05.01.2022 11:55.27.066] [LOG] Server started ...
[05.01.2022 11:55.27.069] [LOG] Connecting socket for: Hello-Lucy
[05.01.2022 11:55.27.071] [LOG] Starting module helper: Hello-Lucy
[05.01.2022 11:55.27.073] [LOG] Sockets connected & modules started ...
[05.01.2022 11:55.27.482] [LOG] Launching application.
[05.01.2022 11:55.37.133] [LOG] Hello-Lucy has recognized: ALL IS THE
[05.01.2022 11:56.16.829] [LOG] Hello-Lucy has recognized: NINE
@sdetweil
Yes, I did run it. Its been a while, and I remember warning about depreciated versions, but nothing that I thought could be an issue. OK to run it again?
ps -ef | grep rec
root 76 2 0 11:02 ? 00:00:00 [vchiq-recy/0]
pi 2320 1927 0 11:24 pts/0 00:00:00 grep --color=auto rec
Not sure what vchiq-recy is…
But no arec or arecord.
@sdetweil
So the arecord -l lists card2 as my expected capture device (seeed-2mic-voicecard). I find it interesting that it enumverates as #2 with no #0 or #1.
Anyway, I ran your ps command; not sure what this output means (as I’m sure you’re aware by now, I’m a Noob on Linux).
ps -ef | grep arec
pi 1953 1927 0 11:04 pts/0 00:00:00 grep --color=auto arec
@sdetweil
With MM running, if I issue
arecord -D default -q -r 16000 -c 1 -t wav -f S16_LE >test.wav
I get a good .wave file that I can play.
With MM still running, specifying the hw explicitly results in an error.
arecord -D hw:2,0 -q -r 16000 -c 1 -t wav -f S16_LE >test2.wav
arecord: main:830: audio open error: Device or resource busy
pi@Magic:~/MagicMirror/config $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 2: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0]
Subdevices: 0/1
Subdevice #0: subdevice #0
@sdetweil said in Hello-Lucy using Adafruit Voice Bonnet:
so it should be
microphone: “2,0”,
Thanks for replying. This config is what I had when I posted. As I mentioned, I’ve tried “0,0”, “1,0”, and “2,0”; all result in the microphone error.
I’m trying to bring up Hello-Lucy on a “new” Magic Mirror. I’m running on a Pi 3B+, and installed the Adafruit Voice Bonnet for audio.
I can do
arecord --format cd --duration 7 --channels 1 test2.wav
then
aplay test2.wav
and I hear the recording from the Voice Bonnet speaker. I don’t have to specify he device for these to work.
When I list my audio devices, I get:
pi@Magic:~/MagicMirror/config $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: vc4hdmi [vc4-hdmi], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
pi@Magic:~/MagicMirror/config $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 2: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
Card 2 for both play and capture is the Voice Bonnet.
When I restart MMM with Hello-Lucy, I hear the default greeting, but always get the microphone shown with ERROR. Even though the lists indicate card 2, I’ve tried 0 and 1 since card 2 is the only thing listed, but still no microphone.
Here’s my config.js file:
/* Magic Mirror Config Sample
*
let config = {
address: “localhost”, // Address to listen on, can be:
// - “localhost”, “127.0.0.1”, “::1” to listen on loopback interface
// - another specific IPv4/6 to listen on a specific interface
// - “0.0.0.0”, “::” to listen on any interface
// Default, when address config is left out or empty, is “localhost”
port: 8081,
basePath: “/”, // The URL path where MagicMirror is hosted. If you are using a Reverse proxy
// you must set the sub path here. basePath must end with a /
ipWhitelist: [“127.0.0.1”, “::ffff:127.0.0.1”, “::1”], // Set [] to allow all IP addresses
// or add a specific IPv4 of 192.168.1.5 :
// [“127.0.0.1”, “::ffff:127.0.0.1”, “::1”, “::ffff:192.168.1.5”],
// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
// [“127.0.0.1”, “::ffff:127.0.0.1”, “::1”, “::ffff:192.168.3.0/28”],
useHttps: false, // Support HTTPS or not, default "false" will use HTTP
httpsPrivateKey: "", // HTTPS private key path, only require when useHttps is true
httpsCertificate: "", // HTTPS Certificate path, only require when useHttps is true
language: "en",
locale: "en-US",
logLevel: ["INFO", "LOG", "WARN", "ERROR"], // Add "DEBUG" for even more logging
timeFormat: 24,
units: "imperial",
// serverOnly: true/false/"local" ,
// local for armv6l processors, default
// starts serveronly and then starts chrome browser
// false, default for all NON-armv6l devices
// true, force serveronly mode, because you want to.. no UI on this device
modules: [
{
disabled: false,
module: "Hello-Lucy",
position: "top_center",
config: {
keyword: 'HELLO LUCY', // keyword to activate listening for a command/sentence
timeout: 15, // timeout listening for a command/sentence
standByMethod: 'DPMS', // 'DPMS' = anything else than RPi or 'PI'
microphone: "1,0", // run "arecord -l" card # and device # mine is "0,0"
sounds: ["1.mp3", "11.mp3"], // welcome sound at startup. Add several for a random greetings
confirmationSound: "ding.mp3", // name and extension of sound file
startHideAll: true, // All modules start as hidden EXCEPT PAGE ONE
// *** Page One is your default startup page *** This overrides startHideAll: true,
pageOneModules: ["Hello-Lucy","MMM-EasyPix"], // default modules to show on page one/startup
pageTwoModules: ["Hello-Lucy", "MMM-BMW-DS", "MMM-EventHorizon"], // modules to show on page two
pageThreeModules: ["Hello-Lucy", "MMM-Lunartic"], // modules to show on page three
pageFourModules: ["Hello-Lucy", "MMM-PC-Stats"], // modules to show on page four
pageFiveModules: ["Hello-Lucy", "MMM-Searchlight"], // modules to show on page five
pageSixModules: ["Hello-Lucy", "MMM-NOAA3"], // modules to show on page six
pageSevenModules: ["Hello-Lucy", "MMM-Recipe"], // modules to show on page seven
pageEightModules: ["Hello-Lucy", "MMM-rfacts"], // modules to show on page eight
pageNineModules: ["Hello-Lucy", "MMM-History"], // modules to show on page nine
pageTenModules: ["Hello-Lucy", "MMM-HardwareMonitor"] // modules to show on page ten
}
},
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== “undefined”) {module.exports = config;}
Any help would be appreciated.