sakirtemel / MMM-alexa

MIT License
51 stars 8 forks source link

Black Screen #1

Open RavixModz opened 7 years ago

RavixModz commented 7 years ago

Hey, when i use this module I always get a black screen when i start the mirror. I already tried it with a fresh install of magic mirror only with default modules (and alexa) but its not working. Please help me

sakirtemel commented 7 years ago

did you use npm install under the module? the module needs few another packages installed.

By the way you can run npm start dev while you're running the mirror, and with that you can see the errors occurred.

RavixModz commented 7 years ago

Ok thanks for reply. Now the mirror starts but alexa is not doing anything. But another voice control modul i tested works. Any idea whats the problem?

sakirtemel commented 7 years ago

There should be status indicator at the mirror with different colors like:

Red, Yellow, Green, or Magenta.

Red shows -> Token set, alexa is ready to listen Green -> Listening Magenta -> Token was wrong/alexa is broken Yellow -> Preparing

Which color do you see at there? If it's red, then it means the connection is good any you only need to invoke the module to start listening by pressing a button on GPIO 18 pin

RavixModz commented 7 years ago

The Status indicator is red. I do not have any button with GPIO 18 pin. Is it possible to use Alexa without a button?

sakirtemel commented 7 years ago

@RavixModz it is possible, but unfortunately the repo does not have Magic Word support yet(Alexa..) (https://github.com/sakirtemel/MMM-alexa#development). I suggest you to connect a button for now.

You can create another module which emits an event to start this module recording. (https://github.com/sakirtemel/MMM-alexa#events)

Or for debugging purposes you can configure debug variable as true and run the mirror with npm start dev and then on console you can type alexaStart() .

RavixModz commented 7 years ago

Thank you. Now I use a voice control module to start Alexa recording with the Keyword "Alexa". When I say it, the status indicator turns intro green. After a few seconds it turn red again and nothing happens.

Error message of the terminal: initializing nodemailer ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.front.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM front ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround40.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround40

ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround41 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround50

ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround51 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround71.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround71 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM iec958 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave

sakirtemel commented 7 years ago

@RavixModz that's awesome that you've managed it with Voice module! I would appreciate if you could create a PR for explaining how to do this in README, or maybe a wiki page, I think that would be useful for other people.

For the error that I'm seeing is probably about the speakers. You may have problems with your playback device. It's most probably because of some configuration. Did you run this command on terminal, which switches audio output from hdmi to RPi?

amixer cset numid=3 1

If nothing works, please try to play an audio with any module, or even at terminal first.

By the way, once I've had similar issue and it was advised to remove pulseaudio, if nothing works please try this:

sudo apt-get --purge remove pulseaudio

I hope one of these will fix your problem, please let me know with the result

RavixModz commented 7 years ago

I tried both but the problem is still the same. I just tested this Demo of Alexa and this works fine. Here is the log of the debug console, maybe this can help to find the problem. localhost-1479994502736.txt

I dont know how to create a PR but i can explain it here and you can add it if you want: I installed this voice control module and created a hotword ( 'Alexa' for example) on https://snowboy.kitt.ai/ that starts alexa.

Config of the voice control module: { module: 'voicecontrol', position: 'bottom_left', config: { models: [ { keyword: "Alexa", description: "Say 'Alexa' to start Alexa", file: "Alexa.pmdl", message: "ALEXA_START_RECORDING" },

    ]
}

},

sakirtemel commented 7 years ago

@RavixModz thanks for the code! I'll add a wiki for that soon.

as far as I can see from the log, the voice activity detection stops before it's started. I added a timeout that's why it's happening like that. When the record starts it waits for 3 seconds, if there's no word then it stops automatically.

So after saying Alexa, and after seeing the the status indicator turns to green, you should see VAD_VOICE_DETECTION_START when you talk. Then it will wait until you finish your sentence.

It's very strange because at the mirror app, you have voice module, and it works fine, so that shows the microphone worked fine. And I assume you have tested that demo at mirror, so the playback device should work fine as well.

What I can suggest to debug this module is enabling debug mode and disabling voice activity detection (https://github.com/sakirtemel/MMM-alexa#configuration-options), also temporarily disable voice module.

And after that please just go to the console, and type alexaStart(), the indicator should turn into green, and after you finish your sentence type alexaStop(), the indicator should turn into red and after few seconds you should hear the response from Alexa side. If the demo works this should also work, because I'm using the same library from that demo.

Make sure that the demo and the mirror are running at the same environments and same browsers

RavixModz commented 7 years ago

Thanks for the quick reply. I did it, but when i type alexaStart() , I always get this error:

VM143:1 Uncaught ReferenceError: alexaStart is not defined(…)(anonymous function) @ VM143:1 motion.js:80 compare result=7,3;28,45

sakirtemel commented 7 years ago

@RavixModz alexaStart() function exist only when you set the debug true in your config, please make sure that the variable is set

https://github.com/sakirtemel/MMM-alexa#configuration-options

RavixModz commented 7 years ago

I forgot to enable it. Now it says:

alexaStart() logger.js:20 clock received a module notification: ALEXA_RECORD_START from sender: MMM-alexa logger.js:20 clock received a module notification: ALEXA_START_RECORDING from sender: MMM-alexa undefined alexaStop() logger.js:20 clock received a module notification: ALEXA_RECORD_STOP from sender: MMM-alexa logger.js:20 clock received a module notification: ALEXA_STOP_RECORDING from sender: MMM-alexa undefined alexaRunner.babel.js:4468 Error: Empty response.(…)alexaRunner.avs.sendAudio.then.catch.error @ alexaRunner.babel.js:4468

btw. is it possible to use "Ok Google" with the magic mirror?

sakirtemel commented 7 years ago

@RavixModz that's strange, and it also gives error in terminal? It looks like your voice is not sent to Alexa. But on the other hand you've told that both the demo and voice control module works at the Mirror. Controlling the microphone is done by the library that is the same as demo has.

With this module you can only connect to Alexa, ok google is another integration and maybe someone has done it already, I don't know that.

RavixModz commented 7 years ago

Mmmh. I just registered a new "product" with Alexa Voice Service on the Amazon Developer website to try it with it. Does I have to add any IP to "Allowed Origins" or "Allowed Return URLs" in the Security Profile settings?

sakirtemel commented 7 years ago

Yes, but you had a product before, right? Because I'm seeing that the token was set successfully before, from your logs

https://sakirtemel.github.io/MMM-alexa/

sakirtemel commented 7 years ago

@RavixModz I had the same issue today with Raspberry Pi 3, the problem is pulseaudio.

When you remove it sudo apt-get --purge remove pulseaudio and configure the things again as described in README, the module works. But this time voicecontrol module does not work.

I think pulseaudio module is not well configured in clean install and it's the one which is making problems. So we need to find a way to enable both modules at the same time because voicecontrol module works only when the pulseaudio is installed.

Donlar714 commented 5 years ago

was there ever a fix for the black screen. i removed pulse audio but still have a black screen and cannot use voice or button. everything else has worked fine until the black screen