MMM-Hotword being on all the time (also MMM-AssistantMk2)



  • I am using MMM-Hotword together with MMM-AssistantMk2 and MMM-NotificationTrigger.

    So far this works great but since some days I have the situation that after correctly recognizing the keyword the microphone stays open which leads to the situation that any following communication is also recognized by Google Assistant as input.

    Sometimes it even creates the situation that an answer spoken by Google Assistant is again recognized by Google Assistant as input - somehow as it would speak with itself.

    This is my config:

    {
          module: "MMM-NotificationTrigger",
          config: {
            triggers:[
              {
                trigger: "HOTWORD_DETECTED",
                fires: [
                  {
                    fire:"HOTWORD_PAUSE",
    
                  },
                  {
                    fire:"ASSISTANT_ACTIVATE",
    		delay: 200,
                    payload: function(payload) {
                      return {
                        "profile": payload.hotword
                      }
                    }
                  },
                ]
              },
              {
                trigger: "ASSISTANT_DEACTIVATED",
                fires: [
                  {
                    fire:"HOTWORD_RESUME"
                  }
                ]
              },
            ]
          }
    },
    
    {
      module: 'MMM-Hotword',
      config: {
        snowboy: [
    	{
    		//hotwords: "smartmirror", //this will be sent to other module for distinguishing which hotword is detected.
    		hotwords: "okhorst",		
    		file: "resources/models/OKHorst.pmdl",
    		sensitivity: '0.7',
    	},
    	{
    		hotwords: "snowboy",
    		file: "resources/models/snowboy.umdl",
    		sensitivity: '0.5',
    	},
    	{
    		file: 'resources/models/jarvis.umdl',
    		sensitivity: '0.8,0.80',
    		hotwords: ['jarvis','jarvis'] //Kitt.ai changed their Jarvis UMDL, it has 2 models in one file. So weird.
    		//anyway, you can give different name for each. ['jarvis_1', 'jarvis_2']. Even though I think this is useless.
    	}
        ],
        record: {
          sampleRate    : 16000,      // audio sample rate
          threshold     : 0.5,        // silence threshold (rec only)
          thresholdStart: null,       // silence threshold to start recording, overrides threshold (rec only)
          thresholdEnd  : null,       // silence threshold to end recording, overrides threshold (rec only)
          silence       : 1.0,        // seconds of silence before ending
          verbose       : true,      // log info to the console
          recordProgram : 'arecord',  // Defaults to 'arecord' - also supports 'rec' and 'sox'
          device        : null        // recording device (e.g.: 'plughw:1')
        },
        autostart: true,              // if 'false', this module will wait for 'HOTWORD_RESUME' notification to start hotwords detection at the beginning.
        autorestart: false,          // You can set this 'true' when you want this module to go back to listening mode automatically again after hotword is detected. But use this carefully when your other modules are using microphone or speaker.
      }
    },
    
    
    {
          module: "MMM-AssistantMk2",
          position: "bottom_right",
          config: {
    		deviceLocation: { // (OPTIONAL)
    			coordinates: { // set the latitude and longitude of the device (rf. mygeoposition.com)
    				latitude: 50.243430, 
    				longitude: 8.652580, 
    			},
    		},
    		defaultProfile: "default", // This default profile should be in `profiles` field.
    		profiles: 	{
    				"default" : 	{
    					profileFile: "default.json", //this path will be `~/MagicMirror/modules/MMM-AssistantMk2/profiles/default.json"
    					lang: "de-DE",
    					},
    				},
    
    
    		},
    },
    
    

  • Module Developer

    @carstend
    You are right. that was not your fault.
    Sometimes Google cloud server sends voice-output after the conversation ends. The problem is, Google Assistant API has not significant current conversation end signal, and there is no definitive way to measure whether conversation ends or not. I think it could be better in next API. (Google Assistant API is beta currently.)


  • Module Developer

    @carstend And you can use multi-array mics for distinguishing your voice from other sounds(including GA itself), That is why real Google Home / Alexa / HomePod use multi-array mics.



  • Thank you for the fast answer. That makes sense since I did not change anything. I will play around a bit with the sensitivity and wait for Google API updates.

    BTW: Great modules!