MagicMirror² v2.4.1 is available! For more information about this release, check out this topic.
Please read the release notes carefully since this update requires adjustments to your Raspberry Pi configuration!

Adding suspend and resume functions into modules



  • Hi everyone,

    Im using the facial recognition and added multiple modules into different classes.
    All the modules works fine together but my CPU load spikes up to ~90-100% at the startup.

    This made me stopping adding new awesome personal modules for each person. I found out the “Suspend and Resume” functions in the Development Documentation. I want to implement it into my Mirror to suspend unused modules.

    The point is if Person1 is recognized, the Default and the Person 2 modules should be suspended and Person 1 should be resumed etc etc.

    I made a short example of my config.js using the clock module and 2 persons.
    If you can help me further with 1 module, the location and the way of using it, i can use the code to add it for the other modules.

    var config = {
    port: 8080,
        
    
    language: 'nl',
    timeFormat: 24,
    units: 'metric',
    
    
    modules: [ 
            	{
            		module: 'clock',
            		position: 'top_left',
            		classes: 'default'
            	},
                    {
                        module: 'currentweather',
                        position: 'top_right',
                        classes: 'Person1',
    			config: {
                            location: 'location',
                            appid: 'APPID'
                            }
                    },
                    {
                        module: 'weatherforecast',
                        position: 'top_right',
    			classes: 'Person2',
                            header: 'Weather Forecast',
                            config: {
                            location: 'location',
                            appid: 'APPID'
                        }
                    },  
                    {
    			module: 'MMM-Facial-Recognition',
    				config: {
    					recognitionAlgorithm: 1,		
    					lbphThreshold: 50,			
    					fisherThreshold: 250,			
    					eigenThreshold: 3000,			
    					useUSBCam: true,			
    					trainingFile: '/home/pi/MagicMirror/modules/MMM-Facial-Recognition/training.xml',	
    					interval: 1,				
    					logoutDelay: 15,			
    					users: ['Person1', 'Person2'],			
    					defaultClass: "default",		
    					everyoneClass: "everyone"		
    				}
    			},		
    //-------------------------------------------------
    	]
    };
    
    /*************** DO NOT EDIT THE LINE BELOW ***************/
    if (typeof module !== 'undefined') {module.exports = config;}