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 11.4k 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

      @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

        @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 Reply Quote 0
        • ? Offline
          A Former User @smackenzie5
          last edited by

          @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 Reply Quote 0
          • S Offline
            smackenzie5 @Guest
            last edited by

            @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 Reply Quote 0
            • ? Offline
              A Former User @smackenzie5
              last edited by A Former User

              @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 Reply Quote 0
              • S Offline
                smackenzie5 @Guest
                last edited by

                @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

                  @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

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

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      sgarg15
                      last edited by

                      @Sean So i followed all the steps and looked at the conversation you had with smackenzie, but i still cant get my monitor to turn off, here my
                      config.js

                          {
                          			module: 'MMM-OnScreenMenu',
                          			position: 'bottom_right',
                      		},
                          {
                          module: "MMM-NotificationTrigger",
                          config: {
                            useWebhook: true,
                            triggers: [
                              {
                                trigger: "MONITOR_OFF_FROM_IFTTT",
                                fires: [
                                  {
                                    fire: "ONSCREENMENU_PROCESS_ACTION",
                                    payload: {"actionName": "monitorOff"}
                                  }
                                ]
                              }
                            ]
                          }
                          },
                      
                      

                      IFTTT request

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

                      and here the log when i say Magic (the keyword)

                      reqpost? { notification: 'MONITOR_OFF_FROM_IFTTT', payload: null }
                      
                      S 1 Reply Last reply Reply Quote 0
                      • S Do not disturb
                        sdetweil @sgarg15
                        last edited by

                        @sgarg15 if you open the developers window console, you should see the notifications being sent

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply Reply Quote 0
                        • S Offline
                          sgarg15
                          last edited by

                          @sdetweil the notification is being but it isnt doing anything to the monitor

                          S 1 Reply Last reply Reply Quote 0
                          • S Do not disturb
                            sdetweil @sgarg15
                            last edited by

                            @sgarg15 so, the onscreen module should be configured to receive and process this, right?
                            ONSCREENMENU_PROCESS_ACTION

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

                            S 1 Reply Last reply Reply Quote 0
                            • S Do not disturb
                              sdetweil @sdetweil
                              last edited by

                              @sdetweil these control modules are just so complex to setup.

                              Sam

                              How to add modules

                              learning how to use browser developers window for css changes

                              S 1 Reply Last reply Reply Quote 0
                              • S Offline
                                sgarg15 @sdetweil
                                last edited by

                                @sdetweil Idk some people got this too work, and i have been looking for something like this for a long time,
                                @Sean When you get time please do have a look

                                Thanks and sorry for multiple pings

                                1 Reply Last reply Reply Quote 0
                                • S Offline
                                  sgarg15
                                  last edited by

                                  Any ideas anyone?

                                  1 Reply Last reply Reply Quote 0
                                  • S Offline
                                    sgarg15
                                    last edited by

                                    its not the this module its MMM-OnScreenMenu, because when i click the turn the monitor off button on the menu, nothing happens

                                    Any ideas how to fix this ?

                                    1 Reply Last reply Reply Quote 0
                                    • S Offline
                                      sgarg15
                                      last edited by

                                      Ok so i got it to work with MMM-Remote-Control, So now i am wondering how can you have multiple commands, like send multiple notifications to for ex. turn on and off the monitor? Any ideas? @Sean

                                      1 Reply Last reply Reply Quote 0
                                      • M Offline
                                        MilkShake
                                        last edited by

                                        Hi, Thanks for the guide. I got it working as IFTTT actually sends a webrequest to my mirror. I am having trouble with the syntax of NotificationTrigger. I already use that module to turn on my Mirror if my gate button is pushed and display an alert.

                                        I would like to execute a script when the trigger OPEN_GATE is received. Here is my current config:

                                        {
                                        module: "MMM-NotificationTrigger",
                                              config: {
                                                  triggers:[
                                                  {
                                                    trigger: "PLAY_SOUND",
                                                    fires: [
                                                      {
                                                        fire:"USER_PRESENCE",
                                                        payload: function(payload) {
                                                          return false
                                        
                                                        }
                                                      },
                                        
                                                      {
                                                        fire:"SHOW_ALERT",
                                                        payload: function(payload) {
                                                          return {
                                                            type: "notification",
                                                            title: "Porten",
                                                            message: "Der er nogen ved porten!"
                                                            }
                                                        },
                                                      }
                                                    ],
                                                  },
                                        
                                                ]
                                              }
                                        },
                                        

                                        Can anyone help with the syntax to add a trigger for “OPEN_GATE” notification that fires a script?

                                        M 1 Reply Last reply Reply Quote 0
                                        • M Offline
                                          MilkShake @MilkShake
                                          last edited by

                                          @MilkShake
                                          Got it to work using:

                                          {
                                             module: "MMM-NotificationTrigger",
                                             config: {
                                               useWebhook:true,
                                          	 triggers:[
                                          	   {
                                          	      trigger: "PLAY_SOUND",
                                          		  fires: [
                                          		    {
                                          			fire: "USER_PRESENCE",
                                          			payload: function(payload) {
                                                            return false
                                                          }
                                          			}
                                          		  
                                          	   ]
                                          	 },
                                          	 {
                                          	    trigger: "OPEN_GATE",
                                          		fires: [
                                          		   {
                                          		   fire: "OPENING_THE_GATE",
                                          		   exec: "sudo python /home/pi/open_gate.py"
                                          		   }
                                          		]
                                          	 },
                                             ]
                                            }
                                          },
                                          
                                          1 Reply Last reply Reply Quote 0
                                          • M Offline
                                            mopedmann
                                            last edited by

                                            Hi guys,
                                            thanks for the great guide @sean.
                                            I am currently using it with MMM-Carousel w/ Slide Navigation and it works fine.
                                            I am struggling to execute a command for another project. https://community.spiceworks.com/how_to/123787-raspberry-pi-powered-surveillance-camera-monitoring-display
                                            The command is /etc/init.d/displaycameras {start|stop|repair}.
                                            How can I execute the command via webhook?
                                            I would be delighted to hear from you.
                                            With kind regards
                                            mopedmann

                                            1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • 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