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.

    MMM-Clap

    Scheduled Pinned Locked Moved System
    25 Posts 4 Posters 8.2k Views 2 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.
    • S Offline
      smarthome @Guest
      last edited by smarthome

      @Sean
      I’ve just configured MMM-Clap to work with MMM Assistant MK2 OK. But can’t work with MMM-Page-Selector and other modules that needs more than one notification trigger parameter,(MMM Assistant MK2 has only one )

      this.sendNotification("PAGE_SELECT", "2");
      

      This is my code in MMM-Clap

      defaultCommandMode: "MODE_DEFAULT",
      				commands: {
      				  "MODE_DEFAULT": {
      					"1": {
      					  notificationExec: {
      						notification: "PAGE_SELECT",
      						payload: {profile: "1"}
      					  },
      					  restart:flase,						
      					  },
                                         }                           
      

      And still can not call CLAP_RESUME & CLAP_PAUSE in notification trigger out of these module, because of it hasn’t got this function

      Tks and waitting for you response !

      ? 1 Reply Last reply Reply Quote 0
      • Cr4z33C Offline
        Cr4z33
        last edited by

        Nice @Sean!

        This is perfect to turn on my mirror display! :smiling_face_with_open_mouth_closed_eyes:

        ? 1 Reply Last reply Reply Quote 0
        • ? Offline
          A Former User @smarthome
          last edited by

          @smarthome
          I cannot understand your intention.
          Why did you use {profile: "1"} as parameter of PAGE_SELECT?
          I think this would;

          "1": {
            notificationExec: {
              notification: "PAGE_SELECT",
              payload: 1
            },
          },
          
          S 1 Reply Last reply Reply Quote 0
          • ? Offline
            A Former User @Cr4z33
            last edited by

            @Cr4z33 Thanks. I think this would be better than untrustworthy Hotword

            1 Reply Last reply Reply Quote 0
            • S Offline
              smarthome @Guest
              last edited by smarthome

              @Sean

              "1": {
                notificationExec: {
                  notification: "PAGE_SELECT",
                  payload: 1
                },
              },
              

              It’s worked to send from MMM-Clap to MMM-Page-Selector
              But still can not call CLAP_RESUME & CLAP_PAUSE in notification trigger out of these modules, because of it hasn’t got this function

              ? 1 Reply Last reply Reply Quote 0
              • Cr4z33C Offline
                Cr4z33
                last edited by Cr4z33

                @Sean module looks loaded correctly, but it is not reacting to my claps?
                I see no evidence of reaction if running npm start.

                I have used the same device like in MMM-Hotwords.

                		{
                		module: "MMM-Clap",
                		position: "bottom_left",
                		disabled: false,
                		config: {
                				detector: {
                						recordDevice: null,
                					},
                		defaultCommandMode: "MODE_DEFAULT",
                		commands: {
                				"MODE_DEFAULT": {
                							"2": {
                								shellExec: {
                										exec: "echo on 0 | cec-client -s -d 1"
                										},
                								restart:true,
                										},
                								},
                						}
                			}
                		},
                

                Still running everything in my Rpi 3 B+ of course. ;)

                ? 1 Reply Last reply Reply Quote 0
                • ? Offline
                  A Former User @smarthome
                  last edited by

                  @smarthome
                  Sorry for my Poor English. I cannot still get your words.
                  Tell me your scenario or use case for using CLAP_RESUME/CLAP_PAUSE. these both might be used when Mic should be released or re-obtained for other module’s usage. In other cases, usually you don’t need to care these.
                  Why do you need and with which modules?

                  S 1 Reply Last reply Reply Quote 0
                  • ? Offline
                    A Former User @Cr4z33
                    last edited by

                    @Cr4z33
                    Show me the log. If works; Belows should be shown.

                    Connecting socket for: MMM-Clap
                    Sockets connected & modules started ...
                    Launching application.
                    [CLAP] Starts.
                    
                    Cr4z33C 1 Reply Last reply Reply Quote 0
                    • Cr4z33C Offline
                      Cr4z33 @Guest
                      last edited by

                      @Sean

                      npm start
                      
                      > magicmirror@2.8.0 start /home/pi/MagicMirror
                      > sh run-start.sh
                      
                      Starting MagicMirror: v2.8.0
                      Loading config ...
                      Loading module helpers ...
                      Initializing new module helper ...
                      Module helper loaded: MMM-Clap
                      Initializing new module helper ...
                      Module helper loaded: MMM-WatchDog
                      Initializing new module helper ...
                      Module helper loaded: MMM-Remote-Control
                      Initializing new module helper ...
                      Module helper loaded: MMM-RTSPStream
                      No helper found for module: alert.
                      Initializing new module helper ...
                      Module helper loaded: updatenotification
                      Initializing new module helper ...
                      Module helper loaded: newsfeed
                      Initializing new module helper ...
                      Module helper loaded: MMM-AssistantMk2
                      No helper found for module: clock.
                      Initializing new module helper ...
                      Module helper loaded: MMM-Spotify
                      Initializing new module helper ...
                      Module helper loaded: MMM-DarkSkyForecast
                      Initializing new module helper ...
                      Module helper loaded: MMM-PushBulletNotifications
                      Initializing new module helper ...
                      Module helper loaded: MMM-Hotword
                      All module helpers loaded.
                      Starting server on port 8080 ... 
                      You're using a full whitelist configuration to allow for all IPs
                      Server started ...
                      Connecting socket for: MMM-Clap
                      Connecting socket for: MMM-WatchDog
                      Starting module helper: MMM-WatchDog
                      Connecting socket for: MMM-Remote-Control
                      Starting node helper for: MMM-Remote-Control
                      Connecting socket for: MMM-RTSPStream
                      PM2: Stopping all OMXPlayer Streams...
                      Connecting socket for: updatenotification
                      Connecting socket for: newsfeed
                      Starting module: newsfeed
                      Connecting socket for: MMM-AssistantMk2
                      Connecting socket for: MMM-Spotify
                      [SPOTIFY_AUTH] Token is fresh.
                      Connecting socket for: MMM-DarkSkyForecast
                      ====================== Starting node_helper for module [MMM-DarkSkyForecast]
                      Connecting socket for: MMM-PushBulletNotifications
                      Connecting socket for: MMM-Hotword
                      [HOTWORD] MMM-Hotword starts
                      Sockets connected & modules started ...
                      Launching application.
                      WatchDog started. Maximum timeout: 10s.
                      Create new news fetcher for url: https://eur.fxexchangerate.com/usd.xml - Interval: 300000
                      Create new news fetcher for url: https://www.ansa.it/sito/notizie/topnews/topnews_rss.xml - Interval: 300000
                      Create new news fetcher for url: https://www.ansa.it/sito/notizie/mondo/mondo_rss.xml - Interval: 300000
                      Create new news fetcher for url: https://feeds.hwupgrade.it/rss_hwup.xml - Interval: 300000
                      Create new news fetcher for url: http://feeds.feedburner.com/hd-blog?format=xml - Interval: 300000
                      Create new news fetcher for url: https://www.tomshw.it/feed/ - Interval: 300000
                      Create new news fetcher for url: https://www.punto-informatico.it/feed/ - Interval: 300000
                      Create new news fetcher for url: http://www.lecceprima.it/rss/ - Interval: 300000
                      Create new news fetcher for url: http://www.galatina.it/rss.xml - Interval: 300000
                      [AMK2] Recipe is loaded: hide_and_show_all_modules.js
                      [AMK2] Recipe is loaded: reboot.js
                      [AMK2] Recipe is loaded: screen_onoff.js
                      [AMK2] Recipe is loaded: shutdown.js
                      [MMM-PushBulletNotifications][Info] 12:24:12.329 - START received
                      [CLAP] Starts.
                      [AMK2] Temporal storage directory is clearing.
                      [HOTWORD] begins.
                      [HOTWORD] Detector starts listening.
                      [MMM-PushBulletNotifications][Info] 12:24:15.355 - PushBullet connected
                      ^CShutting down server...
                      Stopping module helper: MMM-Clap
                      Stopping module helper: MMM-WatchDog
                      Shutting down MMM-RTSPStream streams that were using vlc
                      Stopping module helper: updatenotification
                      Stopping module helper: newsfeed
                      Stopping module helper: MMM-AssistantMk2
                      Stopping module helper: MMM-Spotify
                      Stopping module helper: MMM-DarkSkyForecast
                      Stopping module helper: MMM-PushBulletNotifications
                      Stopping module helper: MMM-Hotword
                      [HOTWORD] Final Result: { detected: false }
                      [HOTWORD] begins.
                      [HOTWORD] Detector starts listening.
                      
                      
                      ? 1 Reply Last reply Reply Quote 0
                      • ? Offline
                        A Former User @Cr4z33
                        last edited by

                        @Cr4z33
                        You are using MMM-Clap & MMM-Hotword at a same time. Have you 2 mics?
                        Or you should control taking & releasing the mic between modules. I don’t recommend.

                        Cr4z33C 1 Reply Last reply Reply Quote 0
                        • Cr4z33C Offline
                          Cr4z33 @Guest
                          last edited by

                          @Sean I’ve got one USB mic.

                          Sorry I am not sure you gave me the solution. :smiling_face_with_open_mouth_cold_sweat:
                          Say again?

                          ? 1 Reply Last reply Reply Quote 0
                          • ? Offline
                            A Former User @Cr4z33
                            last edited by A Former User

                            @Cr4z33
                            MMM-Clap and MMM-Hotword will compete each other to take one mic. I think you’d better to use just one module. At least one module at a time. You can make juggling with CLAP_RESUME, CLAP_PAUSE, HOTWORD_RESUME, HOTWORD_PAUSE to confirm only one module uses a mic at a time. But too complex. not recommended.

                            Cr4z33C 1 Reply Last reply Reply Quote 0
                            • S Offline
                              smarthome @Guest
                              last edited by

                              @Sean
                              The scenario is:
                              Step 1: Clap action
                              Step 2: Clap sound detected, MMM Clap send output notification to MMM Page Selector while Mic still not released yet
                              Step 3: MMM Page Selector receive input notification then change page
                              Step 4: MMM Page Selector sends output notification CLAP_PAUSE to MMM Page Selector to release the MIC and waitting for next clap sound

                              ? 1 Reply Last reply Reply Quote 0
                              • ? Offline
                                A Former User @smarthome
                                last edited by A Former User

                                @smarthome said in MMM-Clap:

                                Step 1: Clap action
                                Step 2: Clap sound detected, MMM Clap send output notification to MMM Page Selector while Mic still not released yet
                                Step 3: MMM Page Selector receive input notification then change page
                                Step 4: MMM Page Selector sends output notification CLAP_PAUSE to MMM Page Selector to release the MIC and waitting for next clap sound

                                In this real usage, You don’t need to release mic at all. MMM-Page-Selector doesn’t use any mic. So why do you need to release mic for changing pages? Mic Releasing is needed only when your other module wants to use the same Mic (like MMM-AssistantMk2). Unless you set restart:false, MMM-Clap will be restarted automatically after detection regardless other module’s job.

                                And If you REALLY want to have a feature - sending some specific notification from specific module -, request module creator to do so. But with this case, I don’t think it needs.

                                ? 1 Reply Last reply Reply Quote 0
                                • ? Offline
                                  A Former User @Guest
                                  last edited by

                                  @smarthome

                                  @Sean said in MMM-Clap:

                                  And If you REALLY want to have a feature - sending some specific notification from specific module -,

                                  Fortunately(???) There is already a solution about this;
                                  As far as I know MMM-Page-Selector could emit PAGE_CHANGED notification.
                                  All you need is to translate that notification to what you need. And MMM-NotificationTrigger module could do that job.

                                  S 1 Reply Last reply Reply Quote 0
                                  • Cr4z33C Offline
                                    Cr4z33 @Guest
                                    last edited by

                                    @Sean said in MMM-Clap:

                                    @Cr4z33
                                    MMM-Clap and MMM-Hotword will compete each other to take one mic. I think you’d better to use just one module. At least one module at a time. You can make juggling with CLAP_RESUME, CLAP_PAUSE, HOTWORD_RESUME, HOTWORD_PAUSE to confirm only one module uses a mic at a time. But too complex. not recommended.

                                    Oh now I got it.

                                    Thanks however I will then keep using MMM-Hotwords.

                                    Too precious for my voice command needs hehe. 😁

                                    1 Reply Last reply Reply Quote 0
                                    • S Offline
                                      smarthome @Guest
                                      last edited by

                                      @Sean
                                      I’d already, but didn’t work

                                      {
                                      		  module: "MMM-NotificationTrigger",
                                      		  //This module works in Background, so you don't need to describe `position`.
                                      		  config: {
                                      			useWebhook: false, // If you want to activate webhook as Notification emitter, set true. (eg. IFTTT)
                                      			triggers:[ // Array of triggers.
                                      			  {
                                      				trigger: "PAGE_CHANGED", //REQUIRED
                                      				triggerSenderFilter: (sender) => { //OPTIONAL should return true or false
                                      				  if (sender == "MMM-Page-Selector") {
                                      					return true
                                      				  }
                                      				  return false
                                      				},
                                      				triggerPayloadFilter: (payload) => { //OPTIONAL should return true or false
                                      				  if (typeof payload.value !== 'undefined' && payload.value > 0) {
                                      					return true
                                      				  }
                                      				  return false
                                      				},
                                      				fires: [ // Array of fires. You can enable multi-firing with one trigger.
                                      				  {
                                      					fire:"CLAP_RESUME", //REQUIRED
                                      					payload: (payload) => { //OPTIONAL. transform received payload to what your target module wants.
                                      					  return payload
                                      					},
                                      		 //           delay: 1000, //OPTIONAL, if this is set, your outgoing notification will be fired after delay.
                                      		 //           exec: "ls -l" //OPTIONAL, if exists, this script will be executed, and the result will be returned with "OUTGOING_NOTIFICATION_RESULT" and payload.  Can also be specified as a function which accepts the payload as an argument and returns the command to execute.
                                      				  },
                                      				],
                                      			  },
                                      			]
                                      		  }
                                      		},
                                      
                                      ? 1 Reply Last reply Reply Quote 0
                                      • ? Offline
                                        A Former User @smarthome
                                        last edited by A Former User

                                        @smarthome
                                        Repeating again; Why do you need CLAP_RESUME/CLAP_PAUSE on page changing? Without them the module will work. I’m a little embarrassed to understand why you need it.

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

                                          @Sean
                                          With MMM Page selector, If I not turn page, i must wait for changing by itself
                                          That’s why I use CLAP to turn page quickly
                                          With MMM Asisstant MK2, I need use MMM Hotword to see my request, if I use another module to trigger, I can’t see it

                                          finally, CLAP and Hotword use at the same time…

                                          ? 1 Reply Last reply Reply Quote 0
                                          • ? Offline
                                            A Former User @smarthome
                                            last edited by

                                            @smarthome
                                            I doubted you might want to use Clap and Hotword together… Maybe possible, but don’t recommend personally.
                                            The easiest solution might be using 2 mics. :D
                                            Anyway, I’ll look inside how to use both module together, (Even I haven’t tried) but it needs some time. sorry.

                                            S 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