Read the statement by Michael Teeuw here.
Alexa to Selfie
-
Hi Guys,
I’m quite new to magic mirror and would be considered new to Linux also.
I’ve been playing around with modules and I llove the work that out but the documentation is hard to understand my my level. I want to control MMM-SelfieShoot with MMM-AlexaControl.
I was able to work out the default start stop PM2 process for the Magic Mirror bur I dont know how to incorporate new notifications. Also I kinda broke the config file while playing around but sure thats the fun of it all I suppose.
Any help would be great I’ve been quite some time with this!
Please see below for my configs.
MAagicMirror config/* 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 modules: [ { disabled: false, module: 'MMM-Astro', position: 'top_left', config: { sign: "leo", iconset: "4", extend: false, } }, { module: 'MMM-AlexaControl', position: 'middle_center', config:{ image: false, pm2ProcessName: "Smart_Mirror", monitorToggle: true, vcgencmd: "hide", deviceName: "Smart Mirror" } }, { 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: { apikey: "f, latitude: " 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;}
MMM-AlexaControl config
/** * Magic Mirror * Module: MMM-AlexaControl * * By JoChef2 * MIT Licensed. */ Module.register("MMM-AlexaControl",{ defaults:{ image: true, // shows the image height: 265, // heigth of the image width: 265, // width of the image pages: 0, // number off pages in MMM-Pages module. 0 means you doesn't use it devices: { // empty object for your custom devices devices: [] }, notifications: [ { name: 'Seflie', port: 11100, OnOff: false, notification: [this.sendNotification("SELFIE_SHOOT")] } ], // empty array for your notification devices commands: [this.sendNotification("SELFIE_SHOOT")], // empty array for your command devices startPort: 11000, // the lowest used port refresh: false, // refresh your Mirror restart: false, selfie: true, // restart your Mirror with pm2 stop: false, // stops your Mirror with pm2 reboot: false, // reboot your pi shutdown: false, // shutdown your pi pm2ProcessName: "Selfie", // name of your pm2 process monitorToggle: false, // switch your monitor on and off vcgencmd: 'vcgencmd', // command you use for monitor toggle cecAddress: "0.0.0.0", // Address for the cec-client usb: false // toggle usb power of your pi }, getTranslations: function(){ // add more translations return { en: "translations/en.json", de: "translations/de.json" } }, start: function(){ Log.log('Starting module: ' + this.name); // send all translations to node_helper this.sendSocketNotification('TRANSLATIONS', {"monitor": this.translate("MONITOR"), "shutdown": this.translate("SHUTDOWN"), "reboot": this.translate("REBOOT"), "page": this.translate("PAGE"), "refresh": this.translate("REFRESH"), "restart": this.translate("RESTART"), "stop": this.translate("STOP"), "selfie": this.translate("SELFIE_SHOOT"), "usb": this.translate("USB"), "deviceName":this.translate(this.config.deviceName)}); this.sendSocketNotification('SET_DEVICE', this.config); // send the config to node_helper }, getDom: function(){ // returns only an image or an empty div (necessary for MMM-Pages) if(this.config.image){ let img = document.createElement("img"); img.classList = "img"; img.src = "MMM-AlexaControl/AlexaLogoGrey.png"; img.height = this.config.height; img.width = this.config.width; return img; }else{ return document.createElement("div"); } }, socketNotificationReceived: function(notification, payload) { if(notification === "PAGE_CHANGED"){ // change pages of MMM-Pages this.sendNotification("PAGE_CHANGED", payload); } if(notification === "ACTION"){ // refresh the Mirror if(payload === "refresh"){ window.location.reload(true); } } if(notification === "selfie"){ this.sendNotification("SELFIE_SHOOT"); // send any notification to any module } if(notification =='MONITOR_ACTION'){ Log.log('RECEIVE monitor NOTIFICATION='+payload) this.sendNotification(notification,payload) } } });
-
@alyx 1st NEVER edit the module source.
all config goes in config.js, for every module
anything in config.js will replace the same item in the module defaults section
for config syntax. see
to diagnose errors
in the MagicMirror folder do
npm run config:check
repeat til no errors…(see the step above about syntax)
-
for AC
notifications: [ { name: 'Seflie', port: 11100, OnOff: false, notification: [this.sendNotification("SELFIE_SHOOT")] } ],
in config.js
u put JUST THE TEXT and data for the notification
notifications: [ { name: 'Seflie', port: 11100, OnOff: false, notification: ["SELFIE_SHOOT", ""] } ],
-
@sdetweil Yes I did try that but it was when my source script for the alexa module was tampered with. I’ll give it another shot and let you guys know how it goes!
-
@sdetweil Sound advise I’ll be sure to remember it! Honeslty makes thing easier too I hate having to edit scripts to communicate to each other in other forms of development haha