MMM-MirrorMirrorOnTheWall and MMM-AlexaPi



  • Hello everyone,

    First of all, thanks to everyone that has written modules for this project as well as the original creator of the magicmirror. This is the most fun I’ve had in a while.

    But, I’m having some trouble getting Alexa working on my magic mirror. Here is what I have:

    • I have installed MMM-AlexaPi and MMM-MirrorMirrorOnTheWall as well as followed the instructions for MirrorMirrorOnTheWallSkill
    • AlexaPi is running and responds to “Alexa” and even answers basic questions.
    • The microphone icon shows on my magic mirror and changes its display when I say “Alexa” and it responds
    • I have a working config.yaml from the AlexaPi setup and use “magicmirror” as the device
    • When I log into my amazon developer console through any browser to test the Alexa skills, I can type something like “show me pictures of dogs” and I get images of dogs on my magic mirror display with the word “dogs” right underneath the photos

    So, my issue is that everything appears to be working, on its own, but Alexa is not truly integrated with my magic mirror because I can’t simply say “Alexa, show me pictures of dogs”. When I do, it responds with something like “I don’t know that one”.

    Here are a few pieces of info that might help someone point me in the right direction (with appropriated info redacted):

    • What I’m using:
      1. Raspberry Pi 3
      2. Raspbian Stretch
      3. MagicMirror 2.2.2
    • nano /etc/opt/AlexaPi/config.yaml
    # See https://github.com/alexa-pi/AlexaPi/wiki/Audio-setup-&-debugging
    # to get a better idea of how to set things in here
    
    # Level of log output
    # default: INFO
    # set to DEBUG for verbose logging
    logging: DEBUG
    
    sound:
      # Name of your microphone device: "magicmirror"
      # leave empty for default
      input_device: "USB PnP Sound Device: Audio (plughw:1,0)"
      # input_device: "magicmirror"
    
      playback_handler: "vlc"
    
      # you can go here with alsa, pulse or others
      # keep blank for the best audio output selected by the underlying code
      output: "pulse"
      # output device: "pulse"
      # currently supports ALSA only
      output_device: "magicmirror"
    
      # if left empty, won't be passed to the underlying library / command if it supports it
      # if it doesn't 100% will be used
      default_volume: 80
    
      # Means the same as above, but is used for media (playing music for example)
      # Leave blank to use the same setting as for speech content
      media_output:
      media_output_device:
      media_default_volume:
    
      # Some device: "magicmirror"
      # value is the number of seconds of silence to pad the beginning and end of the audio. Only
      # the sox handler supports this configuration option.
      playback_padding: 0
    
    # Amazon Alexa settings
    alexa:
      Client_ID: "amzn1.application-oa2-client.1234"
      Client_Secret: "1234"
      Device_Type_ID: "MagicMirror2"
      Security_Profile_Description: "someprofile"
      Security_Profile_ID: "amzn1.application.1234"
      refresh_token: "Atzr|1234"
    
    # See https://github.com/alexa-pi/AlexaPi/wiki/Triggers for the description of these options
    triggers:
      platform:
        enabled: true
        voice_confirm: false
    
        # one of: oneshot-vad, continuous, continuous-vad
        event_type: "oneshot-vad"
    
        # only for "continuous" event_types
        long_press:
          # system command to run after pressing the button for _duration_ number of seconds
          # empty to disable
          command: ""
    
          # duration in seconds
          duration: 10
    
          # CURRENTLY DISABLED
          # optional audio file to play before executing the command
          # you might wanna use full path to make sure AlexaPi finds it
          # you can use {resources_path} for the path to the AlexaPi "resources" directory
          audio_file: ""
    
    
      pocketsphinx:
        enabled: true
        voice_confirm: true
    
        phrase: "alexa"
        threshold: 1e-10
    
    # Commands to run before and after an interaction begins. Leave empty to disable.
    event_commands:
    
      # Example used to lower shairport-sync volume during interaction with alexa
      #     startup: "amixer set shairportvolume 100%"
      #     pre_interaction: "amixer set shairportvolume 10%-""
      #     post_interaction: "amixer set shairportvolume 10%+""
      # Note this assumes you have redirected shairport-syncs audio to a seperate softdevice
      # with control "shairportvolume". Example asound.conf avalible in the scripts folder
    
      # Command to run at the start of AlexaPi
      startup: ""
    
      # Command to run after a trigger is detected but before an interaction begins
      pre_interaction: ""
    
      # Command to run after the interaction has completed
      post_interaction: ""
    
      # Command to run during a clean shutdown of AlexaPi
      shutdown: ""
    
    platform:
      # Name of your platform, e.g. raspberrypi, orangepi, desktop
      device: "magicmirror"
    
    platforms:
      # common config for all platforms (if they support the options)
      # can be overriden in the the respective platform sections
      common:
    
      chip:
        # GPIO Pin with button connected
        button: XIO-P1
        # GPIO Pin for the playback/activity light
        plb_light: XIO-P3
        # GPIO Pin for the recording light
        rec_light: XIO-P5
    
      raspberrypi:
        # GPIO Pin with button connected
        button: 18
        # GPIO Pin for the playback/activity light
        plb_light: 24
        # GPIO Pin for the recording light
        rec_light: 25
    
      orangepi:
        # GPIO Pin with button connected
        button: 20
        # GPIO Pin for the playback/activity light
        plb_light: 9
        # GPIO Pin for the recording light
        rec_light: 8
    
      desktop:
        min_seconds_to_record: 3
    
      dummy:
    
      magicmirror:
        # Magic Mirror - github.com/MichMich/MagicMirror
        # Integrates with MMM-AlexaPi module (github.com/dgonano/MMM-AlexaPi) to display listening, playback, etc status
        # Hostname of the AlexaPi HTTP server, leave empty for any name
        hostname: ""
        # Port the ALexaPi HTTTP server binds to
        port: 5055
        # Hostname of the Magic Mirror
        mm_hostname: "localhost"
        # Port of the Magic Mirror
        mm_port: "8080"
        # How ofter the Hearbeat fires in seconds
        hb_timer: 5
    
      hyperion:
        # Hostname of the Hyperion node's JSON server
        hyperion_json_host: "127.0.0.1"
        # Port of the Hyperion node's JSON server
        hyperion_json_port: 19444
        # Visual status as static 'color' or 'effect'
        # Overridden by 'hyperion_flash_state_xxx'
        hyperion_mode: "effect"
        # Running speed when visualizing as 'effect'
        hyperion_effect_speed: 1
        hyperion_priority: 1
        color_playback: [80, 213, 35]
        color_processing: [35,169,213]
        color_recording: [168, 35, 213]
        flash_duration: 500
        flash_frequency: 8
        # Use Strobe effect instead of default effect or static color
        flash_state_playback: true
        flash_state_processing: false
        flash_state_recording: false
        # Visualize playback state
        indicate_playback: true
        #Also print json request/response when in debug mode
        verbose: false
    
      serial:
        port: "/dev/ttyACM0"
        baudrate: 9600
        messages:
          trigger: ""
          playback_start: "g"
          playback_end: "x"
          recording_start: ""
          recording_end: ""
          processing_start: ""
          processing_end: ""
          failure: ""
          success: ""
    
    
    • sudo systemctl status AlexaPi.service -l
    ● AlexaPi.service - Alexa client for all your devices
       Loaded: loaded (/usr/lib/systemd/system/AlexaPi.service; enabled; vendor preset: enabled)
       Active: active (running) since Tue 2018-03-06 13:09:08 EST; 10s ago
         Docs: https://github.com/alexa-pi/AlexaPi/wiki
     Main PID: 25992 (python)
       CGroup: /system.slice/AlexaPi.service
               └─25992 /usr/bin/python /opt/AlexaPi/src/main.py --daemon
    
    Mar 06 13:09:16 raspberrypi python[25992]: DEBUG: Player State: State.Ended
    Mar 06 13:09:16 raspberrypi python[25992]: DEBUG: Finished play.
    Mar 06 13:09:16 raspberrypi python[25992]: DEBUG: Indicate Stop Playing
    Mar 06 13:09:16 raspberrypi python[25992]: DEBUG: Calling URL: http://localhost:8080/alexapi?action=AVSSTATUS&status=idle
    Mar 06 13:09:16 raspberrypi python[25992]: DEBUG: Response: {"status":"success"}
    Mar 06 13:09:16 raspberrypi python[25992]: DEBUG: Indicating Success
    Mar 06 13:09:16 raspberrypi python[25992]: DEBUG: Calling URL: http://localhost:8080/alexapi?action=AVSSTATUS&status=success
    Mar 06 13:09:16 raspberrypi python[25992]: DEBUG: Response: {"status":"success"}
    Mar 06 13:09:18 raspberrypi python[25992]: DEBUG: Sending MM Heatbeat
    Mar 06 13:09:18 raspberrypi python[25992]: DEBUG: Response: {"status":"success"}
    
    • /opt/AlexaPi/src/main.py -d
    2018-03-06 13:13:22 DEBUG: Setting up playback handler: VlcHandler
    2018-03-06 13:13:22 DEBUG: sound output_device: pulse
    2018-03-06 13:13:22 DEBUG: Setting up Magic Mirror platform
    2018-03-06 13:13:22 INFO: Magic Mirror HTTP Server - :5055
    2018-03-06 13:13:22 INFO: Checking Internet Connection ...
    2018-03-06 13:13:22 DEBUG: Starting new HTTPS connection (1): api.amazon.com
    2018-03-06 13:13:22 DEBUG: https://api.amazon.com:443 "GET /auth/o2/token HTTP/1.1" 404 29
    2018-03-06 13:13:22 INFO: Connection OK
    2018-03-06 13:13:22 INFO: AVS token: Requesting a new one
    2018-03-06 13:13:22 DEBUG: Starting new HTTPS connection (1): api.amazon.com
    2018-03-06 13:13:22 DEBUG: https://api.amazon.com:443 "POST /auth/o2/token HTTP/1.1" 200 946
    2018-03-06 13:13:22 INFO: AVS token: Obtained successfully
    2018-03-06 13:13:22 DEBUG: Starting Magic Mirror platform HTTP Server
    2018-03-06 13:13:22 DEBUG: Starting Magic Mirror heartbeat with 5 second interval
    2018-03-06 13:13:22 DEBUG: Sending MM Heatbeat
    2018-03-06 13:13:22 DEBUG: Response: {"status":"success"}
    2018-03-06 13:13:22 DEBUG: Stopping audio play
    2018-03-06 13:13:22 DEBUG: Playing audio: /opt/AlexaPi/src/resources/hello.mp3
    2018-03-06 13:13:22 DEBUG: Player State: State.Opening
    2018-03-06 13:13:23 DEBUG: Player State: State.Playing
    2018-03-06 13:13:23 DEBUG: Started play. 
    2018-03-06 13:13:23 DEBUG: Indicate Start Playing
    2018-03-06 13:13:23 DEBUG: Calling URL: http://localhost:8080/alexapi?action=AVSSTATUS&status=playback
    2018-03-06 13:13:23 DEBUG: Response: {"status":"success"}
    2018-03-06 13:13:25 DEBUG: Player State: State.Ended
    2018-03-06 13:13:25 DEBUG: Finished play. 
    2018-03-06 13:13:25 DEBUG: Indicate Stop Playing
    2018-03-06 13:13:25 DEBUG: Calling URL: http://localhost:8080/alexapi?action=AVSSTATUS&status=idle
    2018-03-06 13:13:25 DEBUG: Response: {"status":"success"}
    2018-03-06 13:13:25 DEBUG: Indicating Success
    2018-03-06 13:13:25 DEBUG: Calling URL: http://localhost:8080/alexapi?action=AVSSTATUS&status=success
    2018-03-06 13:13:25 DEBUG: Response: {"status":"success"}
    2018-03-06 13:13:27 DEBUG: Sending MM Heatbeat
    
    
    • ~/MagicMirror/config/config.js
    ..................
                    {
                            module: 'MMM-MirrorMirrorOnTheWall',
                            position: "top_bar",
                            config: {},
                            classes: 'default everyone'
                    },
                    {
                            module: 'MMM-AlexaPi',
                            position: 'bottom_bar',
                            config: {
                                    alexaTimeout: 30000,
                                    alexaHBTimeout: 10000
                            },
                            classes: 'default everyone'
                    },
    .................
    
    • pm2 logs --lines 50
    0|mm       | > magicmirror@2.2.2 start /home/pi/MagicMirror
    0|mm       | > sh run-start.sh
    0|mm       | 
    0|mm       | Starting MagicMirror: v2.2.2
    0|mm       | Loading config ...
    0|mm       | Loading module helpers ...
    0|mm       | Initializing new module helper ...
    0|mm       | Module helper loaded: MMM-MirrorMirrorOnTheWall
    0|mm       | Initializing new module helper ...
    0|mm       | Module helper loaded: MMM-AlexaPi
    0|mm       | No helper found for module: alert.
    0|mm       | Initializing new module helper ...
    0|mm       | Module helper loaded: updatenotification
    0|mm       | No helper found for module: MMM-ProfileSwitcher.
    0|mm       | No helper found for module: MMM-RandomPhoto.
    0|mm       | Initializing new module helper ...
    0|mm       | Module helper loaded: MMM-PIR-Sensor
    0|mm       | No helper found for module: clock.
    0|mm       | Initializing new module helper ...
    0|mm       | Module helper loaded: calendar
    0|mm       | No helper found for module: currentweather.
    0|mm       | No helper found for module: weatherforecast.
    0|mm       | Initializing new module helper ...
    0|mm       | Module helper loaded: newsfeed
    0|mm       | Initializing new module helper ...
    0|mm       | Module helper loaded: MMM-PiLights
    0|mm       | Initializing new module helper ...
    0|mm       | Module helper loaded: MMM-Events
    0|mm       | Initializing new module helper ...
    0|mm       | Module helper loaded: MMM-fitbit
    0|mm       | Initializing new module helper ...
    0|mm       | Module helper loaded: MMM-Recipe
    0|mm       | Initializing new module helper ...
    0|mm       | Module helper loaded: MMM-MovieListings
    0|mm       | All module helpers loaded.
    0|mm       | Starting server on port 8080 ... 
    0|mm       | Server started ...
    0|mm       | Connecting socket for: MMM-MirrorMirrorOnTheWall
    0|mm       | Starting module helper: MMM-MirrorMirrorOnTheWall
    0|mm       | Connecting socket for: MMM-AlexaPi
    0|mm       | Starting node helper for: MMM-AlexaPi
    0|mm       | Connecting socket for: updatenotification
    0|mm       | Connecting socket for: MMM-PIR-Sensor
    0|mm       | Connecting socket for: calendar
    0|mm       | Starting node helper for: calendar
    0|mm       | Connecting socket for: newsfeed
    0|mm       | Starting module: newsfeed
    0|mm       | Started node_helper.js for MMM-DailyBibleVerse.
    0|mm       | Connecting socket for: MMM-PiLights
    0|mm       | [2018-03-06 13:17:49] [MMM-PiLights] Starting node_helper
    0|mm       | Connecting socket for: MMM-Events
    0|mm       | Starting node_helper for: MMM-Events
    0|mm       | Connecting socket for: MMM-fitbit
    0|mm       | Starting module helper: MMM-fitbit
    0|mm       | Connecting socket for: MMM-Recipe
    0|mm       | Connecting socket for: MMM-MovieListings
    0|mm       | MMM-MovieListing helper started...
    0|mm       | Sockets connected & modules started ...
    0|mm       | Launching application.
    0|mm       | Attempt to connect to AWS 
    0|mm       | { MODE: { MODE_0: 0, MODE_1: 1, MODE_2: 2, MODE_3: 3 },
    0|mm       |   CS: { none: 64, high: 4, low: 0 },
    0|mm       |   ORDER: { msb: false, lsb: true },
    0|mm       |   Spi: [Function: Spi] }
    0|mm       | Spi { _spi: _spi {}, device: '/dev/spidev0.0' }
    0|mm       | Set credential request recieved.
    0|mm       | { client_id: '1111',
    0|mm       |   client_secret: '1234' }
    0|mm       | Initial run request recieved.
    0|mm       | Running getData.py
    0|mm       | results: [{"message":"credentials.ini exists","type":"status"},{"message":"Writing credentials to credentials.ini","type":"status"},{"message":"Writing id: 1111 and secret: 1234","type":"status"},{"message":"Credentials write successful","type":"status"}]
    0|mm       | Connected to AWS IoT
    0|mm       | Subscribed: MagicMirror:new-text
    0|mm       | Subscribed: MagicMirror:new-images
    0|mm       | Subscribed: MagicMirror:change-module
    0|mm       | Subscribed: MagicMirror:new-video
    0|mm       | Finished getting data
    

    If have read hundreds of posts and followed many links before finally deciding to ask for some help. I’ve been trying to solve this one on my own for too long. If anyone has any suggestions, I would really appreciate the help.



  • IDK. But it sound to me that it is an issue of Amazon blocking some functionality, when using Alexa-Pi… Perhaps try with another solution and compare? (in that case I’d clone the SD card and make a fresh install using another alexa ?)

    BTW. Is there a Amazon cloud control in there somewhere? Perhaps you need to enable image, video searches?



  • I suppose it could be something with Amazon blocking but I would think that one of the logs would have shown some sort of error. Are there other logs or useful tricks for debugging that I may have missed?

    As far as the image and video on Amazon, yes, I have already enabled them.



  • Well, now that I’m looking at the Amazon Developer Console, I’m noticing something that I may have overlooked…My Alexa Skills have not been certified or published. My understanding was that you don’t want to publish the skills because they will then be available to the public. I thought that if I simply avoided those steps, I would be in an acceptable “beta” state since I only need it for home use. The other option I saw was to give access to only an Amazon Business Account, but that doesn’t seem right for the magic mirror setup. Am I thinking about this correctly? Did everyone else here make their MagicMirror2 Alexa skills public?


Log in to reply
 

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.