Navigation

    MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    1. Home
    2. glorianneef
    MagicMirror² v2.15.0 is available! For more information about this release, check out this topic.
    G
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 4
    • Best 0
    • Groups 0

    glorianneef

    @glorianneef

    0
    Reputation
    2
    Profile views
    4
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    glorianneef Follow

    Latest posts made by glorianneef

    • RE: MMM-Arduport trouble

      @sdetweil The only difference I see between that and mine is the extra

        [ .....
      ]
      

      added correct? I added the square brackets and I was still given the same errors

      posted in Troubleshooting
      G
      glorianneef
    • MMM-Arduport trouble

      Hello! So I am simply trying to run this module and I am just making my arduino code send the number “17” just to test. As you can see, when I run my python code, it receives this message correctly. Below is my config file

       {
                  module: "MMM-ArduPort",
                  position: "bottom_right",
                  header: "MMM-ArduPort",
                  config: {
                      portname: "/dev/ttyACM0",
                      displayIcons: true,
                      showDescription: true,
                      hideLoading: true,
                      hideWaiting: true,
                      useColors: true,
                      sensors: 
                          {
                              name: "Timer",
                              description: "LPG, Propane, Hydrogen",
                              maxValue: 19,
                              maxFormat: "({0} cm) TOO FAR",
                              highestValue: 30,
                              highestFormat: "({0} cm) FAR",
                              highValue: 15,
                              highFormat: "({0} cm) NORMAL",
                              lowValue: 10,
                              lowFormat: "({0} cm) CLOSE",
                              lowestValue: 5,
                              lowestFormat: "({0} cm) TOO CLOSE",
                              minValue: 0,
                              minFormat: "({0} cm) OK"
                          }
                  }
              },
      
      

      As you can see when I start

      npm start dev
      

      I get a plethora of errors in which I have no idea how to fix. Any help would be super appreciated.
      2021-02-12-192811_1184x624_scrot[9806].png 2021-02-12-193400_1184x624_scrot[9807].png

      Also here is my arduino code (almost exactly like the one supplied by MMM-arduport git page:

      volatile int32_t m_counter = 0;
      bool WasStarted = false;
      
      static const char *pcMQ2Prefix = "[sensor:Timer:";
      static const char *pcPostfix = "]";
      
      void setup() {
        Serial.begin(9600);
        while(!Serial);
        
        Serial.println("[status:setup:starting]");
        
        int test = 1;
        m_counter = test;
      
        if(test > 1) {
          WasStarted = false;
          Serial.println("[status:setup:failed]");
          return;
        }
        
        delay(3000);
        WasStarted = true;
        Serial.println("[status:setup:started]");
        delay(100);
      }
      
      void loop() {
        //Serial.print(pcMQ2Prefix);
        //Serial.print(m_counter);
        //Serial.println(pcPostfix);
      Serial.println("[sensor:Timer:19]");
        if(m_counter % 3 == 0) {
          delay(1000);
          delay(2000);
        }
      
        if(m_counter >= 60) m_counter = 0;
        m_counter++;
      
        delay(1000);
      }
      
      posted in Troubleshooting
      G
      glorianneef
    • RE: I am a Node.js noob and I created a module for interfacing with a keypad connected to my arduino. The Arduino communicates to my RPi via serial USB. My application keeps crashing...

      Thank you for the reply!
      However, I sadly am still shown a black screen of doom… not too sure.

      posted in Troubleshooting
      G
      glorianneef
    • I am a Node.js noob and I created a module for interfacing with a keypad connected to my arduino. The Arduino communicates to my RPi via serial USB. My application keeps crashing...

      I have checked for configuration errors and this is all fine. Everything seems to go smoothly until I add my node_helper.js. I will upload my config file, main module file, and my helper. Any help would be appreciated. Can’t seem to find the reason for breaking my Magic mirror. =
      MMM-Timer.js

      Module.register("MMM-Timer", {
      // Default module config.
         defaults: {
         	text: "Hello World!"
         },
      
         // Override dom generator.
         getDom: function() {
         	var wrapper = document.createElement("div");
         	wrapper.innerHTML = this.config.text;
         	return wrapper;
         },
         start: function() {
         	this.mySpecialProperty = "So much wow!";
         	Log.log(this.name + ' is started!');
         	var self = this;
         	setInterval(function() {
         	self.updateDom(); // no speed defined, so it updates instantly.
         		}, 1000); //perform every 1000 milliseconds.
         },
         notificationReceived: function(notification, payload, sender) {
         	if (sender) {
         		Log.log(this.name + " received a module notification: " + notification + " from sender: " + sender.name);
         	} else {
         		Log.log(this.name + " received a system notification: " + notification);
         	}
         },
         socketNotificationReceived: function(notification, payload) {
         	Log.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload);
         }
      });
      

      node_helper.js

      var NodeHelper = require("node_helper");
      const { spawn } = require('child_process');
      const child = spawn('~/serial_communication.py');
      
      module.exports = NodeHelper.create({
      	start: function() {
      		this.mySpecialProperty = "So much wow!";
      		Log.log(this.name + ' is started!');
      	},
      	stop: function() {
      		console.log("Shutting down MyModule");
      		console.log('kill');
          		child.kill();
      		this.connection.close();
      	},
      	// Override socketNotificationReceived method.
      
      	socketNotificationReceived: function(notification, payload) {
      		Log.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload);
      	},
      
      	// Test another function
      	aFunction: function() {
      		child.stdout.on('data', (data) => {
        			console.log(`child stdout:\n${data}`);
      		});
      		
      		child.stderr.on('data', (data) => {
        			console.error(`stderr: ${data}`);
      		});
      		child.on('close', (code) => {
        			console.log(`child process exited with code ${code}`);
      		});
      		//want to return the python subprocess
      		this.sendSocketNotification('MY_TIMER_DATA', data);
      	}
      });
      
      posted in Troubleshooting
      G
      glorianneef