• 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.

How do I use notfications

Scheduled Pinned Locked Moved Unsolved Troubleshooting
tutorialhelpnotifications
18 Posts 2 Posters 2.4k 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.
  • A Offline
    Alyx
    last edited by Nov 7, 2021, 6:00 PM

    Hi Guys,

    I’m new to this and have no clue how to use js and notifications.

    I was wondering if someone can help me with setting up some modules to talk to each other. I want to use voice commands to activate a camera module to begin.

    I’m using MMM_Voice_Commands and want to use MMM_SelfieShoot. If someone can help on how to use these that would be great and then I can atleast replicate it for other modules.

    My Conf

    /* Magic Mirror Config Sample
     *
     * By Michael Teeuw https://michaelteeuw.nl
     * MIT Licensed.
     *
     * For more information on how you can configure this file
     * see https://docs.magicmirror.builders/getting-started/configuration.html#general
     * and https://docs.magicmirror.builders/modules/configuration.html
     */
    let config = {
    	address: "localhost", 	// Address to listen on, can be:
    							// - "localhost", "127.0.0.1", "::1" to listen on loopback interface
    							// - another specific IPv4/6 to listen on a specific interface
    							// - "0.0.0.0", "::" to listen on any interface
    							// Default, when address config is left out or empty, is "localhost"
    	port: 8080,
    	basePath: "/", 	// The URL path where MagicMirror is hosted. If you are using a Reverse proxy
    					// you must set the sub path here. basePath must end with a /
    	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], 	// Set [] to allow all IP addresses
    															// or add a specific IPv4 of 192.168.1.5 :
    															// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
    															// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
    															// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
    
    	useHttps: false, 		// Support HTTPS or not, default "false" will use HTTP
    	httpsPrivateKey: "", 	// HTTPS private key path, only require when useHttps is true
    	httpsCertificate: "", 	// HTTPS Certificate path, only require when useHttps is true
    
    	language: "en",
    	locale: "en-UK",
    	logLevel: ["INFO", "LOG", "WARN", "ERROR"], // Add "DEBUG" for even more logging
    	timeFormat: 12,
    	units: "metric",
    	serverOnly:  true/false/"local" ,
    	// local for armv6l processors, default
    	// starts serveronly and then starts chrome browser
    	// false, default for all NON-armv6l devices
    	// true, force serveronly mode, because you want to.. no UI on this device
    
    	notifications: [
            
            {
            name: 'seflie',
            port: 11100,
            OnOff: false,
            notification: ["SELFIE_SHOOT", 'selfie']
        	}
        	
        	],  
    
    	modules: [
    		 
                {
            module: "MMM-Voice-Commands",
            config: {
                debug: true, //Displays end results and errors from annyang in the Log
                autoStart: true, //Adds annyang commands when it first starts
                activateCommand: "hello mirror", //Command to active all other commands
                deactivateCommand: "goodbye mirror", //Command to deactivate all other commands
                alertHeard: true, //Whether an alert should be shown when annyang hears a phrase (mostly for debug)
                commands: {
                    "command statement :variable (optional statement)": "SOCKET_NOTIFICATION_NAME",
                    //The payload of the socket notification will be whatever is said in the :variable
                    "command statement *variable": function(param){
                        alert("Whatever is said in the *variable space is given as the "+param);
                        //These function's 'this' are bound to the module's 'this' so you can do stuff like:
                        this.sendNotification("PAGE_SELECT", "2");
                        this.sendnotifocation("SELFIE_SHOOT, selfie");
                    }
                }
            }
        },
    
    		 {
            disabled: false,
            module: 'MMM-Astro',
            position: 'top_left',
    		      config: {
    		      sign: "leo",
    		      iconset: "4",
    		      extend: false,
    		             }
           },
        {
        module: 'MMM-SleepWake',
        config:{
           mode: 'DPMS'
        }
    },
    {
        module: "MMM-MotionDetector",
        config: {
           captureIntervalTime: 1000,
        	scoreThreshold: 20,
        	timeout: 12
        },
      },
    {
    	disabled: false,
    	module: "MMM-Selfieshot",
    	config: {
    	storePath: "./Storage/Photos",
    	width:1280,
    	height:720,
    	quality: 100,
    	device: null,
    	shootMessage: "Smile!",
    	shootCountdown: 3,
    	displayCountdown: true,
    	displayResult: true,
    	playShutter: true,
    	shutterSound: "shutter.mp3",
    	}
    },
    		{
    			module: "alert",
    		},
    		{
    			module: "updatenotification",
    			position: "top_bar"
    		},
    		{
    			module: "clock",
    			position: "top_center"
    		},
    		
    		{
      		module: "MMM-OpenWeatherMapForecast",
      		header: "Weather",
      		position: "top_right",
      		classes: "default everyone",
      		disabled: false,
      		config: {
        			  
        			iconset: "4c",
        			units: "metric",
        			useAnimatedIcons: true,
        			concise: false,
        			forecastLayout: "table",
        			showWind: true
      			}
    		},
        
    	
    	],
    	 
    };
    
    /*************** DO NOT EDIT THE LINE BELOW ***************/
    if (typeof module !== "undefined") {module.exports = config;}
    

    Voice commands conf. this is a grab from an updated conf so dont worry about the lenght, my part is at the end

    Module.register("MMM-Voice-Commands", {
    
    	defaults: {
    		debug: false, //Displays end results and errors from annyang in the Log
    		autoStart: true, //Adds annyang commands when it first starts
    		activateCommand: "hello mirror", //Command to active all other commands
    		deactivateCommand: "goodbye mirror", //Command to deactivate all other commands
    		alertHeard: false, //Wether an alert should be shown when annyang hears a phrase (mostly for debug)
    		commands: {
    			"socket test :payload": "TEST_SOCKET",
    			"function test :payload": function(payload){alert("Test: "+payload)} //in these functions 'this' is bound to the module so this.sendNotification() is valid
    		}
    	},
    
    	start: function() {
    		this.rawCommands = this.config.commands;
    		this.autoStart = this.config.autoStart;
    		this.activateCommand = this.config.activateCommand;
    		this.deactivateCommand = this.config.deactivateCommand;
    		this.alertHeard = this.config.alertHeard;
    		this.debug = this.config.debug;
    
    		this.commands = {};
    		this.active = false
    
    		this.initAnnyang();
    	},
    
    	initAnnyang: function(){
    		const self = this;
    		if (annyang) {
    
    			//Iterate over commands list to create a valid annyang command object
    			for (var key in self.rawCommands) {
    				if (self.rawCommands.hasOwnProperty(key)) {
    					//If the property is already a function, leave it that way. Otherwise assume it is a socket name
    					if(typeof self.rawCommands[key] !== "function"){
    						//Construct a valid function...
    						function createCommand(socket){
    							return function(payload){
    								self.sendNotification(socket, payload);
    							}
    						}
    
    						//...And then put it in the object
    						self.commands[key] = createCommand(self.rawCommands[key])
    					}else{
    						self.commands[key] = self.rawCommands[key].bind(self);
    					}
    				}
    			}
    
    			if(self.autoStart){
    				annyang.addCommands(self.commands);
    				self.active = true;
    			}
    
    			const standardCommands = {}
    			standardCommands[self.activateCommand] = function(){
    				if(!self.active){
    					self.addCommands(self.commands);
    					self.active = true;
    					self.sendNotification("SHOW_ALERT", {type: "notification", title: "Voice Commands", message: "Activated"});
    				}else{
    					self.sendNotification("SHOW_ALERT", {type: "notification", title: "Voice Commands", message: "Already Active"});
    				}
    			}
    
    			standardCommands[self.deactivateCommand] = function(){
    				if(self.active){
    					self.removeCommands(self.commands);
    					self.active = false;
    					self.sendNotification("SHOW_ALERT", {type: "notification", title: "Voice Commands", message: "Deactivated"});
    				}else{
    					self.sendNotification("SHOW_ALERT", {type: "notification", title: "Voice Commands", message: "Already Deactivated"});
    				}
    			}
    
    			annyang.addCommands(standardCommands);
    
    			annyang.start();
    
    			if(self.debug){
    				annyang.addCallback("result", function(e){
    					Log.log(e)
    				})
    
    				annyang.addCallback("error", function(e){
    					Log.log(e)
    				})
    			}
    
                // This is the code that I added to add a similar experience to Hello-Lucy
          if (self.alertHeard) {
            annyang.addCallback("result", function(e) {
              for (var i = 0; i < e.length; i++) {
    
                // Get First result from annyang, which will be closest speech match
                // Format notification into format to match MMM-HelloLucy
                var notification = e[i]
                  .toUpperCase()
                  .trim()
                  .replace(" ", "_");
    
                // MMM-Voice-Commands sends notification to MMM-GoogleMapsTraffic to HIDE
                if (notification === "HIDE_TRAFFIC") {
                  self.sendNotification("HIDE_TRAFFIC");
                }
    
                // Check if notification is requesting location
                else if (notification.indexOf("SHOW_TRAFFIC") > -1) {
                  // MMM-Voice-Commands sends notification to MMM-GoogleMapsTraffic to SHOW Default location per config
                  if (notification === "SHOW_TRAFFIC") {
                    self.sendNotification("SHOW_TRAFFIC");
                  }
    
                  // MMM-Voice-Commands sends notification to MMM-GoogleMapsTraffic to SHOW passed location from voice
                  else {
                    var indexOfNotification = notification.indexOf("SHOW_TRAFFIC");
                    var strippedPayload = notification
                      .replace("_", " ")
                      .substr(ind + 8, notification.length)
                      .trim();
                    var location = st
                      .replace("of", "")
                      .trim()
                      .replace("for", "")
                      .trim();
                    self.sendNotification("SHOW_TRAFFIC", location);
                  }
                }
    
    
                ////////////////////////////////////////////////////////////////////////////////////////////////////////
                // Add Additional Modules similar to below
    
                // MMM-Voice-Commands sends notification to MMM-Cocktails to HIDE
                else if (notification === "HIDE_COCKTAILS") {
                  self.sendNotification("HIDE_COCKTAILS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Cocktails to SHOW
                else if (notification === "SHOW_COCKTAILS") {
                  self.sendNotification("SHOW_COCKTAILS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Clock to HIDE
                else if (notification === "HIDE_CLOCK") {
                  self.sendNotification("HIDE_CLOCK");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Clock to SHOW
                else if (notification === "SHOW_CLOCK") {
                  self.sendNotification("SHOW_CLOCK");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Newsfeed to HIDE
                else if (notification === "HIDE_NEWSFEED") {
                  self.sendNotification("HIDE_NEWSFEED");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Newsfeed to SHOW
                else if (notification === "SHOW_NEWSFEED") {
                  self.sendNotification("SHOW_NEWSFEED");
                }
    
                // MMM-Voice-Commands sends notification to MMM-AlarmClock to HIDE
                else if (notification === "HIDE_ALARM") {
                  this.sendNotification("HIDE_ALARM");
                }
    
                // MMM-Voice-Commands sends notification to MMM-AlarmClock to SHOW
                else if (notification === "SHOW_ALARM") {
                  this.sendNotification("SHOW_ALARM");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Back to HIDE
                else if (notification === "HIDE_BACKGROUND") {
                  this.sendNotification("HIDE_BACKGROUND");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Back to SHOW
                else if (notification === "SHOW_BACKGROUND") {
                  this.sendNotification("SHOW_BACKGROUND");
                }
    
                // MMM-Voice-Commands sends notification to calendar to HIDE
                else if (notification === "HIDE_CALENDAR") {
                  this.sendNotification("HIDE_CALENDAR");
                }
    
                // MMM-Voice-Commands sends notification to calendar to SHOW
                else if (notification === "SHOW_CALENDAR") {
                  this.sendNotification("SHOW_CALENDAR");
                }
    
                // MMM-Voice-Commands sends notification to MMM-CARDS to HIDE
                else if (notification === "HIDE_CARDS") {
                  this.sendNotification("HIDE_CARDS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-CARDS to SHOW
                else if (notification === "SHOW_CARDS") {
                  this.sendNotification("SHOW_CARDS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Census to HIDE
                else if (notification === "HIDE_CENSUS") {
                  this.sendNotification("HIDE_CENSUS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Census to SHOW
                else if (notification === "SHOW_CENSUS") {
                  this.sendNotification("SHOW_CENSUS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-CLOCK to HIDE
                else if (notification === "HIDE_CLOCK") {
                  this.sendNotification("HIDE_CLOCK");
                }
    
                // MMM-Voice-Commands sends notification to MMM-CLOCK to SHOW
                else if (notification === "SHOW_CLOCK") {
                  this.sendNotification("SHOW_CLOCK");
                }
    
                // MMM-Voice-Commands sends notification to MMM-COCKTAILS to HIDE
                else if (notification === "HIDE_COCKTAILS") {
                  this.sendNotification("HIDE_COCKTAILS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-COCKTAILS to SHOW
                else if (notification === "SHOW_COCKTAILS") {
                  this.sendNotification("SHOW_COCKTAILS");
                }
    
                // MMM-Voice-Commands sends notification to compliments to HIDE
                else if (notification === "HIDE_COMPLIMENTS") {
                  this.sendNotification("HIDE_COMPLIMENTS");
                }
    
                // MMM-Voice-Commands sends notification to compliments to SHOW
                else if (notification === "SHOW_COMPLIMENTS") {
                  this.sendNotification("SHOW_COMPLIMENTS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-NOAA to HIDE
                else if (notification === "HIDE_COWBOY") {
                  this.sendNotification("HIDE_COWBOY");
                }
    
                // MMM-Voice-Commands sends notification to MMM-NOAA to SHOW
                else if (notification === "SHOW_COWBOY") {
                  this.sendNotification("SHOW_COWBOY");
                }
    
                // MMM-Voice-Commands sends notification to MMM-EOL to HIDE
                else if (notification === "HIDE_DARWIN") {
                  this.sendNotification("HIDE_DARWIN");
                }
    
                // MMM-Voice-Commands sends notification to MMM-EOL to SHOW
                else if (notification === "SHOW_DARWIN") {
                  this.sendNotification("SHOW_DARWIN");
                }
    
                // MMM-Voice-Commands sends notification to MMM-EARTH to HIDE
                else if (notification === "HIDE_EARTH") {
                  this.sendNotification("HIDE_EARTH");
                }
    
                // MMM-Voice-Commands sends notification to MMM-EARTH to SHOW
                else if (notification === "SHOW_EARTH") {
                  this.sendNotification("SHOW_EARTH");
                }
    
                // MMM-Voice-Commands sends notification to MMM-EyeCandy to HIDE
                else if (notification === "HIDE_EYECANDY") {
                  this.sendNotification("HIDE_EYECANDY");
                }
    
                // MMM-Voice-Commands sends notification to MMM-EyeCandy to SHOW
                else if (notification === "SHOW_EYECANDY") {
                  this.sendNotification("SHOW_EYECANDY");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Events to HIDE
                else if (notification === "HIDE_EVENTS") {
                  this.sendNotification("HIDE_EVENTS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Events to SHOW
                else if (notification === "SHOW_EVENTS") {
                  this.sendNotification("SHOW_EVENTS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-rfacts to HIDE
                else if (notification === "HIDE_FAX") {
                  this.sendNotification("HIDE_FAX");
                }
    
                // MMM-Voice-Commands sends notification to MMM-rfacts to SHOW
                else if (notification === "SHOW_FAX") {
                  this.sendNotification("SHOW_FAX");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Glock to HIDE
                else if (notification === "HIDE_FLIPPER") {
                  this.sendNotification("HIDE_FLIPPER");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Glock to SHOW
                else if (notification === "SHOW_FLIPPER") {
                  this.sendNotification("SHOW_FLIPPER");
                }
    
                // MMM-Voice-Commands sends notification to MMM-FlightsAbove to HIDE
                else if (notification === "HIDE_FLIGHTS") {
                  this.sendNotification("HIDE_FLIGHTS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-FlightsAbove to SHOW
                else if (notification === "SHOW_FLIGHTS") {
                  this.sendNotification("SHOW_FLIGHTS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Fortune to HIDE
                else if (notification === "HIDE_FORTUNE") {
                  this.sendNotification("HIDE_FORTUNE");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Fortune to SHOW
                else if (notification === "SHOW_FORTUNE") {
                  this.sendNotification("SHOW_FORTUNE");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Gas to HIDE
                else if (notification === "HIDE_GAS") {
                  this.sendNotification("HIDE_GAS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Gas to SHOW
                else if (notification === "SHOW_GAS") {
                  this.sendNotification("SHOW_GAS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-JEOPARDY to HIDE
                else if (notification === "HIDE_JEOPARDY") {
                  this.sendNotification("HIDE_JEOPARDY");
                }
    
                // MMM-Voice-Commands sends notification to MMM-JEOPARDY to SHOW
                else if (notification === "SHOW_JEOPARDY") {
                  this.sendNotification("SHOW_JEOPARDY");
                }
    
                // MMM-Voice-Commands sends notification to MMM-LICE to HIDE
                else if (notification === "HIDE_LICE") {
                  this.sendNotification("HIDE_LICE");
                }
    
                // MMM-Voice-Commands sends notification to MMM-LICE to SHOW
                else if (notification === "SHOW_LICE") {
                  this.sendNotification("SHOW_LICE");
                }
    
                // MMM-Voice-Commands sends notification to MMM-URHere to HIDE
                else if (notification === "HIDE_LOCATION") {
                  this.sendNotification("HIDE_LOCATION");
                }
    
                // MMM-Voice-Commands sends notification to MMM-URHere to SHOW
                else if (notification === "SHOW_LOCATION") {
                  this.sendNotification("SHOW_LOCATION");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Lottery to HIDE
                else if (notification === "HIDE_LOTTERY") {
                  this.sendNotification("HIDE_LOTTERY");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Lottery to SHOW
                else if (notification === "SHOW_LOTTERY") {
                  this.sendNotification("SHOW_LOTTERY");
                }
    
                // MMM-Voice-Commands sends notification to MMM-EasyPix to HIDE
                else if (notification === "HIDE_LUCY") {
                  this.sendNotification("HIDE_LUCY");
                }
    
                // MMM-Voice-Commands sends notification to MMM-EasyPix to SHOW
                else if (notification === "SHOW_LUCY") {
                  this.sendNotification("SHOW_LUCY");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Lunartic to HIDE
                else if (notification === "HIDE_MOON") {
                  this.sendNotification("HIDE_MOON");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Lunartic to SHOW
                else if (notification === "SHOW_MOON") {
                  this.sendNotification("SHOW_MOON");
                }
    
                // MMM-Voice-Commands sends notification to MMM-NASA to HIDE
                else if (notification === "HIDE_NASA") {
                  this.sendNotification("HIDE_NASA");
                }
    
                // MMM-Voice-Commands sends notification to MMM-NASA to SHOW
                else if (notification === "SHOW_NASA") {
                  this.sendNotification("SHOW_NASA");
                }
    
                // MMM-Voice-Commands sends notification to MMM-NEO to HIDE
                else if (notification === "HIDE_NEO") {
                  this.sendNotification("HIDE_NEO");
                }
    
                // MMM-Voice-Commands sends notification to MMM-NEO to SHOW
                else if (notification === "SHOW_NEO") {
                  this.sendNotification("SHOW_NEO");
                }
    
                // MMM-Voice-Commands sends notification to newsfeed to HIDE
                else if (notification === "HIDE_NEWS") {
                  this.sendNotification("HIDE_NEWS");
                }
    
                // MMM-Voice-Commands sends notification to newsfeed to SHOW
                else if (notification === "SHOW_NEWS") {
                  this.sendNotification("SHOW_NEWS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-PETFINDER to HIDE
                else if (notification === "HIDE_PETFINDER") {
                  this.sendNotification("HIDE_PETFINDER");
                }
    
                // MMM-Voice-Commands sends notification to MMM-PETFINDER to SHOW
                else if (notification === "SHOW_PETFINDER") {
                  this.sendNotification("SHOW_PETFINDER");
                }
    
                // MMM-Voice-Commands sends notification to MMM-FMI to HIDE
                else if (notification === "HIDE_PHONE") {
                  this.sendNotification("HIDE_PHONE");
                }
    
                // MMM-Voice-Commands sends notification to MMM-FMI to SHOW
                else if (notification === "SHOW_PHONE") {
                  this.sendNotification("SHOW_PHONE");
                }
    
                // MMM-Voice-Commands sends notification to MMM-ImageSlideshow to HIDE
                else if (notification === "HIDE_PICTURES") {
                  this.sendNotification("HIDE_PICTURES");
                }
    
                // MMM-Voice-Commands sends notification to MMM-ImageSlideshow to SHOW
                else if (notification === "SHOW_PICTURES") {
                  this.sendNotification("SHOW_PICTURES");
                }
    
                // MMM-Voice-Commands sends notification to MMM-PilotWX to HIDE
                else if (notification === "HIDE_PILOTS") {
                  this.sendNotification("HIDE_PILOTS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-PilotWX to SHOW
                else if (notification === "SHOW_PILOTS") {
                  this.sendNotification("SHOW_PILOTS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-AfterShip to HIDE
                else if (notification === "HIDE_SHIPPING") {
                  this.sendNotification("HIDE_SHIPPING");
                }
    
                // MMM-Voice-Commands sends notification to MMM-AfterShip to SHOW
                else if (notification === "SHOW_SHIPPING") {
                  this.sendNotification("SHOW_SHIPPING");
                }
    
                // MMM-Voice-Commands sends notification to MMM-ISS to HIDE
                else if (notification === "HIDE_STATION") {
                  this.sendNotification("HIDE_STATION");
                }
    
                // MMM-Voice-Commands sends notification to MMM-ISS to SHOW
                else if (notification === "SHOW_STATION") {
                  this.sendNotification("SHOW_STATION");
                }
    
                // MMM-Voice-Commands sends notification to MMM-PC-Stats to HIDE
                else if (notification === "HIDE_STATS") {
                  this.sendNotification("HIDE_STATS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-PC-Stats to SHOW
                else if (notification === "SHOW_STATS") {
                  this.sendNotification("SHOW_STATS");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Sudoku to HIDE
                else if (notification === "HIDE_SUDOKU") {
                  this.sendNotification("HIDE_SUDOKU");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Sudoku to SHOW
                else if (notification === "SHOW_SUDOKU") {
                  this.sendNotification("SHOW_SUDOKU");
                }
    
                // MMM-Voice-Commands sends notification to MMM-SunRiseSet to HIDE
                else if (notification === "HIDE_SUNRISE") {
                  this.sendNotification("HIDE_SUNRISE");
                }
    
                // MMM-Voice-Commands sends notification to MMM-SunRiseSet to SHOW
                else if (notification === "SHOW_SUNRISE") {
                  this.sendNotification("SHOW_SUNRISE");
                }
    
                // MMM-Voice-Commands sends notification to MMM-SORT to HIDE
                else if (notification === "HIDE_TIDES") {
                  this.sendNotification("HIDE_TIDES");
                }
    
                // MMM-Voice-Commands sends notification to MMM-SORT to SHOW
                else if (notification === "SHOW_TIDES") {
                  this.sendNotification("SHOW_TIDES");
                }
    
                // MMM-Voice-Commands sends notification to MMM-EventHorizon to HIDE
                else if (notification === "HIDE_TIMER") {
                  this.sendNotification("HIDE_TIMER");
                }
    
                // MMM-Voice-Commands sends notification to MMM-EventHorizon to SHOW
                else if (notification === "SHOW_TIMER") {
                  this.sendNotification("SHOW_TIMER");
                }
    
                // MMM-Voice-Commands sends notification to MMM-ATM to HIDE
                else if (notification === "HIDE_TRIVIA") {
                  this.sendNotification("HIDE_TRIVIA");
                }
    
                // MMM-Voice-Commands sends notification to MMM-ATM to SHOW
                else if (notification === "SHOW_TRIVIA") {
                  this.sendNotification("SHOW_TRIVIA");
                }
    
                // MMM-Voice-Commands sends notification to MMM-Voice-Commands to HIDE
                else if (notification === "HIDE_VOICE") {
                  this.hide(1000);
                }
    
                // MMM-Voice-Commands sends notification to MMM-Voice-Commands to SHOW
                else if (notification === "SHOW_VOICE") {
                  this.show(1000);
                }
    
                // MMM-Voice-Commands sends notification to MMM-BMW-DS to HIDE
                else if (notification === "HIDE_WEATHER") {
                  this.sendNotification("HIDE_WEATHER");
                }
    
                // MMM-Voice-Commands sends notification to MMM-BMW-DS to SHOW
                else if (notification === "SHOW_WEATHER") {
                  this.sendNotification("SHOW_WEATHER");
                }
    
                // MMM-Voice-Commands sends notification to MMM-EarthWinds to HIDE
                else if (notification === "HIDE_WIND") {
                  this.sendNotification("HIDE_WIND");
                }
    
                // MMM-Voice-Commands sends notification to MMM-EarthWinds to SHOW
                else if (notification === "SHOW_WIND") {
                  this.sendNotification("SHOW_WIND");
                }
    
                // MMM-Voice-Commands sends notification to MMM-SelfieShoot to CAPTURE
                else if (notification === "SELFIE_SHOOT") {
                  this.sendNotification("SELFIE_SHOOT");
                }
              }
            });
          }
        }
      },
    
    	addCommands: function(commands){
    		annyang.abort();
    		annyang.addCommands(commands);
    		annyang.start();
    	},
    
    	removeCommands: function(commands){
    		annyang.abort();
    		var test1 = typeof commands;
    		var test2 = Array.isArray(commands)
    		if(typeof commands === "object") annyang.removeCommands(Array.isArray(commands) ? commands : Object.keys(commands));
    		annyang.start()
    	},
    
    	getScripts: function() {
    		return[
    			this.file("js/annyang.min.js"),
    		]
    	},
    })
    
    S 1 Reply Last reply Nov 7, 2021, 7:58 PM Reply Quote 0
    • S Offline
      sdetweil @Alyx
      last edited by Nov 7, 2021, 7:58 PM

      @alyx said in How do I use notfications:

      self.sendNotification(“SHOW_ALERT”, {type: “notification”, title: “Voice Commands”, message: “Deactivated”})

      thats all u have to do

      sendNotification(“string”, optional_parameters needed by receiver of message

      this is a broadcast… all modules get it…

      so when u figure out what the command is then do that

      self.sendNotification(“SELFIE_SHOOT”, ???)
      make sure ‘self’ is set when u make the call

      where ??? is optional parms, (don’t supply it if not used)

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      A 1 Reply Last reply Nov 7, 2021, 8:06 PM Reply Quote 0
      • A Offline
        Alyx @sdetweil
        last edited by Nov 7, 2021, 8:06 PM

        @sdetweil

        Ok so for selfie shoot all I need to do is to input in my MM conf, self.sendNotification(“SELFIE_SHOOT”, “selfie”) ‘selfie’ is the voice command i wish to call. And I put this where i call the selfie_shoot module or the voice commands module?

        Sorry I’ll need some hand holding with the request haha

        S 1 Reply Last reply Nov 7, 2021, 8:13 PM Reply Quote 0
        • S Offline
          sdetweil @Alyx
          last edited by Nov 7, 2021, 8:13 PM

          @alyx said in How do I use notfications:

          self.sendNotification(“SELFIE_SHOOT”,

          sorry, after looking at the module, i don’t understand what its looking for in its config…

          supposedly you would have to write no code.

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          A 1 Reply Last reply Nov 7, 2021, 8:16 PM Reply Quote 0
          • A Offline
            Alyx @sdetweil
            last edited by Nov 7, 2021, 8:16 PM

            @sdetweil so then should I remove my notification code and any reference I’ve made?

            S 1 Reply Last reply Nov 7, 2021, 8:17 PM Reply Quote 0
            • S Offline
              sdetweil @Alyx
              last edited by Nov 7, 2021, 8:17 PM

              @alyx i don’t know.

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              A 1 Reply Last reply Nov 7, 2021, 8:20 PM Reply Quote 0
              • A Offline
                Alyx @sdetweil
                last edited by Nov 7, 2021, 8:20 PM

                @sdetweil I did there with no results, how would you usually set this up? I’ve tried following the documentation but its hard for myself to understand.

                https://github.com/mykle1/Hello-Lucy/blob/master/How to add modules to Hello-Lucy

                The dev of the custom config I use said to follow this but it doesnt make sense to me

                S 1 Reply Last reply Nov 7, 2021, 8:47 PM Reply Quote 0
                • A Offline
                  Alyx
                  last edited by Nov 7, 2021, 8:42 PM

                  I was playing around with the default compliments module and apparently it is supposed to work out of the box with the voice_commands config I have although that doesnt seem to be the case… Am I doing something wrong form the start?

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    sdetweil @Alyx
                    last edited by Nov 7, 2021, 8:47 PM

                    @alyx are u an english speaker? if not translate the file to your language

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    A 1 Reply Last reply Nov 7, 2021, 8:49 PM Reply Quote 0
                    • A Offline
                      Alyx @sdetweil
                      last edited by Nov 7, 2021, 8:49 PM

                      @sdetweil yep I am, I’m thinking of moving to another module. I’m thinking Hello Lucy, do you have any recommendations? As long as I can make it communicate with a module I dont care haha

                      S 1 Reply Last reply Nov 7, 2021, 8:50 PM Reply Quote 0
                      • 1
                      • 2
                      • 1 / 2
                      1 / 2
                      • First post
                        2/18
                        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