MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. emrhssla
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    E Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 13
    • Posts 49
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: node_helper.js does not work.

      @sdetweil I don’t see what the problem is.

      After upgrading the npm and node to the latest version, I installed the Magic Mirror, and I wonder if that’s the problem.

      And I did the npm install python3 and I don’t think this is the cause.

      posted in Troubleshooting
      E
      emrhssla
    • RE: node_helper.js does not work.

      @sdetweil

      pi@raspberrypi:~ $ ls /home/pi/Desktop/Beauty/MagicMirror/config -laF
      total 20
      drwxr-xr-x 2 pi pi 4096 Apr 15 22:18 ./
      drwxr-xr-x 17 pi pi 4096 Apr 15 22:16 …/
      -rw-r–r-- 1 pi pi 2960 Apr 15 2019 config.js
      -rw-r–r-- 1 pi pi 2623 Apr 15 22:11 config.js.sample
      -rw-r–r-- 1 pi pi 13 Apr 15 22:29 .gitignore

      posted in Troubleshooting
      E
      emrhssla
    • RE: node_helper.js does not work.

      @sdetweil

      /* Magic Mirror Config Sample
       *
       * By Michael Teeuw http://michaelteeuw.nl
       * MIT Licensed.
       *
       * For more information how you can configurate this file
       * See https://github.com/MichMich/MagicMirror#configuration
       *
       */
      
      var config = {
      	address: "0.0.0.0", // 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, is "localhost"
      	port: 8080,
      	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1","172.16.100.133", "::ffff:172.16.100.133", "::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"],
      
      	language: "en",
      	timeFormat: 24,
      	units: "metric",
      
      	modules: [
      		//0
      		{
      			module: 'MMM-iFrame',
      			position: "bottom_center",	// This can be any of the regions.
      			config: {
      				// See 'Configuration options' for more information.
      					url: ["https://comic.naver.com/webtoon/weekday.nhn"],  // as many URLs you want or you can just ["ENTER IN URL"] if single URL.
      					updateInterval: 0.5 * 60 * 1000, // rotate URLs every 30 seconds
      					width: "2000", // width of iframe
      					height: "1800", // height of iframe
      					frameWidth: "950", // width of embedded iframe, height is beeing calculated by aspect ratio of iframe
      				}
      		},
      		//1
      		{
      			module: "MMM-EmbedYoutube1", 
      			position: "bottom_bar",	
      			config: {
      				video_id: "w3jLJU7DT5E",
      				searchlist1: "쯔위",
      				loop: true
      			}
      		},
      		//2	
              {
                  module: "MMM-Modulebar1",
                  position: "top_left", 
                  classes: "default everyone", 
                  config: {
      						
                      
                  }
      		},
      		//3
      		{
                  module: "MMM-Modulebar",
                  position: "top_left",
                  classes: "default everyone", 
                  config: {
      						
      
                  
                  }
              },
              
      		{
      			module: "updatenotification",
      			position: "top_bar"
      		},
      		{
      			module: "clock",
      			position: "top_right"
      		},
      		
      		{
      			module: "newsfeed",
      			position: "bottom_bar",
      			config: {
      				feeds: [
      					{
      						title: "New York Times",
      						url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"
      					}
      				],
      				showSourceTitle: true,
      				showPublishDate: true
      			}
      		},
      		{
      			  module: "MMM-Testpython",
      			  disabled: false,
      			  position: "middle",
      			  config:{
      			    
      			  }
      		}
      	]
      
      };
      

      It’s the same. :(

      pi@raspberrypi:~/Desktop/Beauty/MagicMirror $ npm start &
      [1] 3066
      pi@raspberrypi:~/Desktop/Beauty/MagicMirror $ 
      > magicmirror@2.7.1 start /home/pi/Desktop/Beauty/MagicMirror
      > sh run-start.sh
      
      Starting MagicMirror: v2.7.1
      Loading config ...
      Loading module helpers ...
      Initializing new module helper ...
      Module helper loaded: updatenotification
      No helper found for module: helloworld.
      All module helpers loaded.
      Starting server on port 8080 ... 
      Server started ...
      Connecting socket for: updatenotification
      Sockets connected & modules started ...
      Launching application.
      
      
      posted in Troubleshooting
      E
      emrhssla
    • RE: node_helper.js does not work.

      @sdetweil

      /* Magic Mirror Config Sample
       *
       * By Michael Teeuw http://michaelteeuw.nl
       * MIT Licensed.
       *
       * For more information how you can configurate this file
       * See https://github.com/MichMich/MagicMirror#configuration
       *
       */
      
      var config = {
      	address: "0.0.0.0", // 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, is "localhost"
      	port: 8080,
      	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1","172.16.100.133", "::ffff:172.16.100.133", "::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"],
      
      	language: "en",
      	timeFormat: 24,
      	units: "metric",
      
      	modules: [
      		//0
      		{
      			module: 'MMM-iFrame',
      			position: "bottom_center",	// This can be any of the regions.
      			config: {
      				// See 'Configuration options' for more information.
      					url: ["https://comic.naver.com/webtoon/weekday.nhn"],  // as many URLs you want or you can just ["ENTER IN URL"] if single URL.
      					updateInterval: 0.5 * 60 * 1000, // rotate URLs every 30 seconds
      					width: "2000", // width of iframe
      					height: "1800", // height of iframe
      					frameWidth: "950", // width of embedded iframe, height is beeing calculated by aspect ratio of iframe
      				}
      		},
      		//1
      		{
      			module: "MMM-EmbedYoutube1", 
      			position: "bottom_bar",	
      			config: {
      				video_id: "w3jLJU7DT5E",
      				searchlist1: "쯔위",
      				loop: true
      			}
      		},
      		//2	
              {
                  module: "MMM-Modulebar1",
                  position: "top_left", 
                  classes: "default everyone", 
                  config: {
      						
                      
                  }
      		},
      		//3
      		{
                  module: "MMM-Modulebar",
                  position: "top_left",
                  classes: "default everyone", 
                  config: {
      						
      
                  
                  }
              },
              
              {
                  module: "MMM-Dynamic-Modules",
              },
      		{
      			module: "alert",
      		},
      		{
      			module: "updatenotification",
      			position: "top_bar"
      		},
      		{
      			module: "clock",
      			position: "top_right"
      		},
      		
      		{
      			module: "newsfeed",
      			position: "bottom_bar",
      			config: {
      				feeds: [
      					{
      						title: "New York Times",
      						url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"
      					}
      				],
      				showSourceTitle: true,
      				showPublishDate: true
      			}
      		},
      		{
      			  module: "MMM-Testpython",
      			  disabled: false,
      			  position: "middle",
      			  config:{
      			    
      			  }
      		},
      	]
      
      };
      
      posted in Troubleshooting
      E
      emrhssla
    • RE: node_helper.js does not work.

      @sdetweil
      0_1555333403414_e8ec6fad-d376-44a8-b46f-e1284090eaed-image.png

      posted in Troubleshooting
      E
      emrhssla
    • RE: npm install error

      @sdetweil

      pi@raspberrypi:~/Desktop/Chanyoung/BeautyMirrorTEST $ rm -rf node_modules
      pi@raspberrypi:~/Desktop/Chanyoung/BeautyMirrorTEST $ npm install
      npm WARN deprecated time-grunt@2.0.0: Deprecated because Grunt is practically unmaintained. Move on to something better. This package will continue to work with Grunt v1, but it will not receive any updates.
      npm ERR! code ENOLOCAL
      npm ERR! Could not install from "node_modules/danger/vm2@github:patriksimek/vm2#7e82f90ac705fc44fad044147cb0df09b4c79a57" as it does not contain a package.json file.
      
      npm ERR! A complete log of this run can be found in:
      npm ERR!     /home/pi/.npm/_logs/2019-04-15T12_43_25_301Z-debug.log
      
      

      …?

      posted in Troubleshooting
      E
      emrhssla
    • RE: node_helper.js does not work.

      @sdetweil
      in terminal, output is

      pi@raspberrypi:~/Desktop/MagicMirror $ npm start dev &
      [1] 1452
      pi@raspberrypi:~/Desktop/MagicMirror $
      
      magicmirror@2.7.1 start /home/pi/Desktop/MagicMirror
      sh run-start.sh “dev”
      
      Starting MagicMirror: v2.7.1
      Loading config …
      Loading module helpers …
      Initializing new module helper …
      Module helper loaded: updatenotification
      No helper found for module: helloworld.
      All module helpers loaded.
      Starting server on port 8080 …
      Server started …
      Connecting socket for: updatenotification
      Sockets connected & modules started …
      Launching application.
      

      after click,That’s all.
      There are no errors, and console.log() is not visible from the terminal window.

      0_1555332611559_6e3ba171-204b-47e8-9524-7552eb23b661-image.png

      posted in Troubleshooting
      E
      emrhssla
    • node_helper.js does not work.

      I transferred what I had done with Mac to the Raspberry pie. I only tried the basic reservation code because the result I wanted was not available. But it didn’t work, either.
      It’s good at Mac. Why not at Raspberry Pi?
      MMM-TestPython.js

      var Testpythons;
      Module.register("MMM-Testpython", {
      
          defaults: {},
          start: function (){
              Testpythons = this;
          },
        
        getDom: function() {
          var element = document.createElement("div")
          element.className = "myContent"
          element.id="divid"
          element.innerHTML = "Hello, World!!! " + this.config.foo
          var subElement = document.createElement("p")
          subElement.innerHTML = "Click" 
          subElement.id = "clickid"
          element.appendChild(subElement)
          return element
        },
        
        notificationReceived: function(notification, payload, sender) {
          switch(notification) {
            case "DOM_OBJECTS_CREATED":
            var elem = document.getElementById("clickid")
            elem.addEventListener("click", () => {
              Testpythons.sendSocketNotification("TEST")
              console.log("hello~hello~hello~hello~hello~hello~hello~hello~hello~hello~")
              elem.innerHTML = "click success"       
            }) 
              break
          }
        },
        socketNotificationReceived: function(notification, payload) {
          switch(notification) {
            case "I_DID":
              console.log("Socket recevied : "+payload)
              var elemk = document.getElementById("divid")
              elemk.innerHTML = payload
              break
          }
        }
      
      })
      

      node_helper.js

      var NodeHelper = require("node_helper");
      var socketTestpython;
      module.exports = NodeHelper.create({
        start: function() {
          socketTestpython=this;
        },
        
        socketNotificationReceived: function(notification, payload) {
          switch(notification) {
            case "TEST":
              console.log("notification : " + notification)
      	socketTestpython.sendSocketNotification("I_DID",'hello');        
              break
          }
        },
      }) 
      

      npm start dev &
      0_1555326314342_d20cc3c4-142c-4377-baea-0b17916eee89-image.png

      0_1555326347786_4c2e1957-c49d-4d63-950a-8414ae7ebc35-image.png

      in terminal=>

      pi@raspberrypi:~/Desktop/MagicMirror $ npm start dev &
      [1] 1452
      pi@raspberrypi:~/Desktop/MagicMirror $

      magicmirror@2.7.1 start /home/pi/Desktop/MagicMirror
      sh run-start.sh “dev”

      Starting MagicMirror: v2.7.1
      Loading config …
      Loading module helpers …
      Initializing new module helper …
      Module helper loaded: updatenotification
      No helper found for module: helloworld.
      All module helpers loaded.
      Starting server on port 8080 …
      Server started …
      Connecting socket for: updatenotification
      Sockets connected & modules started …
      Launching application.

      posted in Troubleshooting
      E
      emrhssla
    • npm install error

      I am working with my friend on a project. When I downloaded what my friend had been working on with my raspberry pie and installed npm start, I got the error:
      0_1555310776532_d9fb8868-2613-4b33-a10d-a0d7000d7d14-image.png 0_15
55304255464_b4b7f1e4-c8e5-459d-88d5-7c58c63552d1-image.png
      Friend’s environment is Mac, and I downloaded it to the raspberry pie.

      My freiend’s repository is https://github.com/ENTITYSmartMirror/BeautyMirrorTEST

      Friend installed and used python-shell module on April 15.

      /home/pi/Desktop/BeautyMirrorTEST/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron: 1: /home/pi/Desktop/BeautyMirrorTEST/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron: ���� � 0: not found
      /home/pi/Desktop/BeautyMirrorTEST/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron: 4: /home/pi/Desktop/BeautyMirrorTEST/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron: Syntax error: word unexpected (expecting “)”)
      npm ERR! code ELIFECYCLE
      npm ERR! errno 2
      npm ERR! magicmirror@2.6.0 start: sh run-start.sh
      npm ERR! Exit status 2
      npm ERR!
      npm ERR! Failed at the magicmirror@2.6.0 start script.
      npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

      npm ERR! A complete log of this run can be found in:
      npm ERR! /home/pi/.npm/_logs/2019-04-15T06_36_00_871Z-debug.log

      posted in Troubleshooting
      E
      emrhssla
    • RE: Even a simple node_help.js example does not run.

      @sdetweil

      0_1555081065957_ef2bd581-f7e5-44c1-afc3-6df8fea70a50-image.png

      omg…

      posted in Troubleshooting
      E
      emrhssla
    • RE: Even a simple node_help.js example does not run.

      @sdetweil

      {
        "name": "MMMTestpython",
        "description": "samples",
        "version": "0.0.1",
        "dependencies": {
          "python-shell": "latest"
        }
      }
      
      

      Do I have to change it like this and install it again? npm install

      0_1555077390063_231c85f3-9d06-4cd8-a2ec-fa08f4db34ee-image.png

      posted in Troubleshooting
      E
      emrhssla
    • RE: I don't know how to use node_helper.js.

      @sdetweil oh!!! 0_1555075761914_acdbfe01-9c20-45b9-a177-87d554b225e0-image.png
      thank you very very very much :)

      posted in Troubleshooting
      E
      emrhssla
    • RE: Even a simple node_help.js example does not run.

      @sdetweil said in Even a simple node_help.js example does not run.:

      console.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload);

      var NodeHelper = require("node_helper");
      //var {PythonShell} = require('python-shell');
      
      module.exports = NodeHelper.create({
        start: function() {},
        
        socketNotificationReceived: function(notification, payload) {
          console.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload);
        },
      })   
      

      0_1555075600760_f2b5f62a-75bc-48ea-9a97-7c88d676b3d5-image.png
      omg…

      posted in Troubleshooting
      E
      emrhssla
    • RE: Even a simple node_help.js example does not run.

      @sdetweil 0_1555074987553_d58a7d49-677c-4048-a9e4-709a574bc29a-image.png

      Is it normal for these errors to occur?
      /modules/MMM-Testpython/package.json

      posted in Troubleshooting
      E
      emrhssla
    • Even a simple node_help.js example does not run.

      MMM-Testpython

      var Testpythons;
      Module.register("MMM-Testpython", {
      
          defaults: {},
          start: function (){
              Testpythons = this;
          },
        
        getDom: function() {
          var element = document.createElement("div")
          element.className = "myContent"
          element.id="divid"
          element.innerHTML = "Hello, World!!! " + this.config.foo
          var subElement = document.createElement("p")
          subElement.innerHTML = "Click" 
          subElement.id = "clickid"
          element.appendChild(subElement)
          return element
        },
        
        notificationReceived: function(notification, payload, sender) {
          switch(notification) {
            case "DOM_OBJECTS_CREATED":
            var elem = document.getElementById("clickid")
            elem.addEventListener("click", () => {
              Testpythons.sendSocketNotification("TEST")
              console.log("hello~hello~hello~hello~hello~hello~hello~hello~hello~hello~")
              elem.innerHTML = "click success"       
            }) 
              break
          }
        },
        
      })
      

      node_helper.js

      var NodeHelper = require("node_helper");
      var {PythonShell} = require('python-shell');
      
      module.exports = NodeHelper.create({
        start: function() {},
        
        socketNotificationReceived: function(notification, payload) {
          switch(notification) {
            case "TEST":
              console.log("notification : " + notification)
              this.sendSocketNotification("I_DID")
              break
          }
        },
      })  
      

      0_1555061178870_43ed7384-d4d5-4421-8c6b-a664582b6883-image.png
      0_1555061131673_64d4b79c-9344-4c93-9f4f-31ed55371eca-image.png
      The notification I_DID in node_helper.js was well communicated and executed. However, the console in node_helper.js is not output…
      What is the problem?

      var NodeHelper = require("node_helper");
      var {PythonShell} = require('python-shell');
      
      module.exports = NodeHelper.create({
        start: function() {},
        
        socketNotificationReceived: function(notification, payload) {
          Log.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload);
          
        },
      })  
      

      0_1555061311849_80e6e224-4ff0-45e5-89e5-93ad49f7cc0d-image.png

      0_1555061325787_4d1587ba-527f-4a4c-92c0-8c5c5b1dbff7-image.png

      Even a simple node_help.js example does not run.

      posted in Troubleshooting
      E
      emrhssla
    • RE: I don't know how to use node_helper.js.

      @sdetweil

      var NodeHelper = require("node_helper");
      var {PythonShell} = require('python-shell');
      
      module.exports = NodeHelper.create({
        start: function() {
          console.log("Starting module: " + this.name);
        },
        
        socketNotificationReceived: function(notification, payload) {
          console.log("Starting module: " + this.name);
          switch(notification) {
            case "TESTPYTHON":
              console.log("notification : " + notification)
              this.sendSocketNotification("I_DID")
              PythonShell.runString('print("Hello Python")', null, function (err, result) {
                  if (err) throw err;
                  console.log(result);  
                  });
              break
          }
        },
      })  
      

      0_1555054288241_a49a1a4e-d8c3-4e5c-8463-81b9df38737c-image.png

      console doesnt show Starting module…

      posted in Troubleshooting
      E
      emrhssla
    • I don't know how to use node_helper.js.

      I tried to use python-shell. So I successfully finished the npm install python-shell.
      But I saw it said that to use python-shell, you must use node_helper.js.
      So I tried to execute a simple Python code. The notification I_DID in node_helper.js was well communicated and executed. However, the console in node_helper.js is not output, nor is python-shell working.
      What is the problem?

      var Testpythons;
      Module.register("MMM-Testpython", {
      
          defaults: {},
          start: function (){
              Testpythons = this;
          },
        
        getDom: function() {
          var element = document.createElement("div")
          element.className = "myContent"
          element.id="divid"
          element.innerHTML = "Hello, World!!! " + this.config.foo
          var subElement = document.createElement("p")
          subElement.innerHTML = "Click" 
          subElement.id = "clickid"
          element.appendChild(subElement)
          return element
        },
        
        notificationReceived: function(notification, payload, sender) {
          switch(notification) {
            case "DOM_OBJECTS_CREATED":
            var elem = document.getElementById("clickid")
            elem.addEventListener("click", () => {
              Testpythons.sendSocketNotification("TESTPYTHON")
              console.log("hello~hello~hello~hello~hello~hello~hello~hello~hello~hello~")
              elem.innerHTML = "click success"
              
            }) 
              break
          }
        },
        socketNotificationReceived: function(notification, payload) {
          switch(notification) {
            case "I_DID":
              console.log("success")
              var elemk = document.getElementById("divid")
              elemk.innerHTML = "I_DID"
              break
          }
        },
      })
      

      node_helper.js

      var NodeHelper = require("node_helper");
      var PythonShell = require('python-shell');
      
      module.exports = NodeHelper.create({
        start: function() {
          console.log("Starting module: " + this.name);
        },
        
        socketNotificationReceived: function(notification, payload) {
          switch(notification) {
            case "TESTPYTHON":
              console.log("notification : " + notification)
              this.sendSocketNotification("I_DID")
              PythonShell.runString('print("Hello Python")', null, function (err, result) {
                  if (err) throw err;
                  console.log(result);  
                  });
              break
          }
        },
      })  
      
      posted in Troubleshooting
      E
      emrhssla
    • RE: How can I change the variable value of the config after the magic mirror is run? I want to change the config of MMM-embedYoutube through MMM-Modulebar.

      @sdetweil success using notification! thank you!

      posted in Troubleshooting
      E
      emrhssla
    • 1
    • 2
    • 3
    • 2 / 3