• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

[Guide] Control MM via Google Home

Scheduled Pinned Locked Moved General Discussion
24 Posts 6 Posters 7.5k Views 6 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    A Former User @smackenzie5
    last edited by A Former User Aug 26, 2019, 7:00 AM Aug 26, 2019, 6:59 AM

    @smackenzie5 said in [Guide] Control MM via Google Home:

    Err:1 http://raspbian.raspberrypi.org/raspbian stretch/main armhf nginx-common

    Hmmm. Sometimes, Repositories could not be reached by accident. (Due to Network problem, DNS mismatch, Server maintenance, or any other reasons. Who knows.) Try again later.

    Before that; try this;

    sudo apt-get update
    suod apt-get upgrade
    
    S 1 Reply Last reply Aug 31, 2019, 9:17 PM Reply Quote 0
    • S Offline
      smackenzie5 @Guest
      last edited by Aug 31, 2019, 9:17 PM

      @Sean
      Can you read through the code below and determine where the error is?

      First, updating like you said did the trick. After updating/upgrading I was able to download everything and complete Step 2. Went on to complete Steps 3 & 4 and the IFTTT test worked.

      Now, I’m trying to use the format of your test code and rewrite it to turn my monitor off using OnScreenMenu. I get the following error message:

      pi@raspberrypi:~ $ cd MagicMirror
      pi@raspberrypi:~/MagicMirror $ sudo npm start
      
      > magicmirror@2.7.1 start /home/pi/MagicMirror
      > sh run-start.sh
      
      Starting MagicMirror: v2.7.1
      Loading config ...
      Loading module helpers ...
      No helper found for module: alert.
      No helper found for module: clock.
      Initializing new module helper ...
      Module helper loaded: calendar
      No helper found for module: currentweather.
      No helper found for module: weatherforecast.
      No helper found for module: MMM-google-route.
      Initializing new module helper ...
      Module helper loaded: MMM-OnScreenMenu
      Initializing new module helper ...
      Module helper loaded: MMM-NotificationTrigger
      All module helpers loaded.
      Starting server on port 8080 ... 
      Server started ...
      Connecting socket for: calendar
      Starting node helper for: calendar
      Connecting socket for: MMM-OnScreenMenu
      Connecting socket for: MMM-NotificationTrigger
      Sockets connected & modules started ...
      Launching application.
      Create new calendar fetcher for url: https://calendar.google.com/calendar/ical/xxx/basic.ics - Interval: 300000
      SyntaxError: Unexpected token a in JSON at position 96
          at JSON.parse (<anonymous>)
          at parse (/home/pi/MagicMirror/node_modules/body-parser/lib/types/json.js:89:19)
          at /home/pi/MagicMirror/node_modules/body-parser/lib/read.js:121:18
          at invokeCallback (/home/pi/MagicMirror/node_modules/body-parser/node_modules/raw-body/index.js:224:16)
          at done (/home/pi/MagicMirror/node_modules/body-parser/node_modules/raw-body/index.js:213:7)
          at IncomingMessage.onEnd (/home/pi/MagicMirror/node_modules/body-parser/node_modules/raw-body/index.js:273:7)
          at IncomingMessage.emit (events.js:182:13)
          at endReadableNT (_stream_readable.js:1090:12)
          at process._tickCallback (internal/process/next_tick.js:63:19)
      
      

      My config.js is here:

      {
          			module: 'MMM-OnScreenMenu',
          			position: 'bottom_right',
      		},
      		{
        			module: "MMM-NotificationTrigger",
        			config: {
      			    useWebhook:true,
      			    triggers:[
      			      {
       		       		trigger: "ONSCREENMENU_PROCESS_ACTION",
       		       		fires: [
       		       		  {
       		           		fire:"notificationReceived",
       		           		payload: (payload) => {return payload}
      		        	  },
      		        	       ],
      			      },
      			]
      			}
      		},
      

      My IFTTT is here:

      {
       "sender":{
        "name":"IFTTT"
       },
       "notification":"ONSCREENMENU_PROCESS_ACTION",
       "payload":{actionName: 'monitorOff'
       }
      }
      

      Thoughts?

      Thanks,
      Scott

      ? 1 Reply Last reply Sep 1, 2019, 11:24 AM Reply Quote 0
      • ? Offline
        A Former User @smackenzie5
        last edited by Sep 1, 2019, 11:24 AM

        @smackenzie5 said in [Guide] Control MM via Google Home:

        {
        “sender”:{
        “name”:“IFTTT”
        },
        “notification”:“ONSCREENMENU_PROCESS_ACTION”,
        “payload”:{actionName: ‘monitorOff’
        }
        }

        JSON syntax is somehow strict than usual JS convention.

        {
          "sender":{
            "name":"IFTTT"
          },
          "notification":"ONSCREENMENU_PROCESS_ACTION",
          "payload":{
              "actionName": "monitorOff"
          }
        }
        

        will work. you have failed/missed on using double-quotation marks.

        1 Reply Last reply Reply Quote 0
        • S Offline
          smackenzie5
          last edited by Sep 1, 2019, 3:14 PM

          @Sean
          Thanks - that fixed the error message however it still doesn’t turn the monitor off.
          I’m not sure what else to look at now. Below is what I’m seeing but with no error message, kind of hard to tell what to work on.

          I’m considering installing Remote-Control and seeing if I can get that to work unless you’ve got another thought.

          Thanks,
          Scott

          pi@raspberrypi:~ $ cd MagicMirror
          pi@raspberrypi:~/MagicMirror $ sudo npm start
          
          > magicmirror@2.7.1 start /home/pi/MagicMirror
          > sh run-start.sh
          
          Starting MagicMirror: v2.7.1
          Loading config ...
          Loading module helpers ...
          No helper found for module: alert.
          No helper found for module: clock.
          Initializing new module helper ...
          Module helper loaded: calendar
          No helper found for module: currentweather.
          No helper found for module: weatherforecast.
          No helper found for module: MMM-google-route.
          Initializing new module helper ...
          Module helper loaded: MMM-OnScreenMenu
          Initializing new module helper ...
          Module helper loaded: MMM-NotificationTrigger
          All module helpers loaded.
          Starting server on port 8080 ... 
          Server started ...
          Connecting socket for: calendar
          Starting node helper for: calendar
          Connecting socket for: MMM-OnScreenMenu
          Connecting socket for: MMM-NotificationTrigger
          Sockets connected & modules started ...
          Launching application.
          Create new calendar fetcher for url: https://calendar.google.com/calendar/ical/xxx/basic.ics - Interval: 300000
          reqpost? { sender: { name: 'IFTTT' },
            notification: 'ONSCREENMENU_PROCESS_ACTION',
            payload: { actionName: 'monitorOff' } }
          
          
          ? 1 Reply Last reply Sep 1, 2019, 3:55 PM Reply Quote 0
          • ? Offline
            A Former User @smackenzie5
            last edited by Sep 1, 2019, 3:55 PM

            @smackenzie5
            I don’t know anything about OnScreenMenu. Have you any link to inspect?
            I think your “fire” would be wrong. “NotificationReceived” is not usual type of notification conventions. Anyway if i see how Onscreenmenu works I may tell you more.

            S 1 Reply Last reply Sep 1, 2019, 7:37 PM Reply Quote 0
            • S Offline
              smackenzie5 @Guest
              last edited by Sep 1, 2019, 7:37 PM

              @Sean
              OnScreenMenu is one of the 3rd Party modules here:
              https://github.com/shbatm/MMM-OnScreenMenu

              I used notificationReceived because it was similar to your example of SHOW_ALERT.
              From alert.js - show_alert: function(params, sender) {
              From MMM-NotificationTrigger.js - notificationReceived: function (notification, payload, sender) {
              Maybe not correct but that’s why I did it.

              Here’s where I got the example used for the content of notification and payload:
              https://github.com/shbatm/MMM-AlexaOnOff/blob/master/README.md
              Again, maybe not correct but that’s why I did it.

              {
                  module: 'MMM-OnScreenMenu',
                  position: 'bottom_right',
              },
              {
                  module: 'MMM-AlexaOnOff',
                  config: {
                      devices: [{ 
                            name: "Magic Mirror",
                            on: { 
                              notification: "ONSCREENMENU_PROCESS_ACTION",
                              payload: { actionName:'monitorOn' }
                            },
                            off: { 
                              notification: "ONSCREENMENU_PROCESS_ACTION",
                              payload: { actionName:'monitorOff' }
                            },
                      }]
                  }
              }
              

              Thoughts?

              Thanks,
              Scott

              ? 1 Reply Last reply Sep 2, 2019, 8:00 AM Reply Quote 0
              • ? Offline
                A Former User @smackenzie5
                last edited by A Former User Sep 2, 2019, 8:01 AM Sep 2, 2019, 8:00 AM

                @smackenzie5
                As far as I read OnScreenMenu module,
                it needs notification like this;

                • notification : ONSCREENMENU_PROCESS_ACTION
                • payload:
                  • “actionName” : “monitorOn”

                So you can make your IFTTT & NotificationTrigger recipe like this;
                IFTTT recipe

                {
                  "notification": "MONITOR_ON_FROM_IFTTT",
                  "payload": null
                }
                

                MMM-NotificationTrigger

                module: "MMM-NotificationTrigger",
                config: {
                  useWebhook: true,
                  triggers: [
                    {
                      trigger: "MONITOR_ON_FROM_IFTTT",
                      fires: [
                        {
                          fire: "ONSCREENMENU_PROCESS_ACTION",
                          payload: {"actionName": "monitorOn"}
                        }
                      ]
                    }
                  ]
                }
                

                I didn’t test those codes on real machine so there could be some syntax error, but I believe you can understand the concept

                S 1 Reply Last reply Sep 3, 2019, 12:07 AM Reply Quote 0
                • S Offline
                  smackenzie5 @Guest
                  last edited by Sep 3, 2019, 12:07 AM

                  @Sean
                  You sir, are a freakin’ genius - it works perfectly.
                  Thanks again for all the effort.

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    sgarg15
                    last edited by Apr 22, 2020, 9:58 PM

                    @Sean If possible could you give an example of how our config file should look like if we wanted to use the google home to turn on and off the monitor?

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      sgarg15
                      last edited by Apr 22, 2020, 10:06 PM

                      Also if i were using MMM-Remote-Control besides MMM-OnScreenMenu, how would it work?

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 1 / 3
                      • First post
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy