• 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
  1. Home
  2. Perlchamp
  3. Posts
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
Offline
  • Profile
  • Following 0
  • Followers 0
  • Topics 6
  • Posts 171
  • Groups 0

Posts

Recent Best Controversial
  • RE: read csv-data and put it in an array

    i have another information for you (github - MMM-Logging):

    You can find more detailed information on debugging your MagicMirror here: Module Debugging. If you also want the Electron rederer (web browser) console logs to be printed to the standard console (or PM2 logs), change the following line to the very top of ~/MagicMirror/run-start.sh <<

    this file does not exist. i can’t find it in the file-manager (i see all hidden files) …

    posted in Utilities
    P
    Perlchamp
    Apr 30, 2020, 5:19 PM
  • RE: read csv-data and put it in an array

    ok, understand

    posted in Utilities
    P
    Perlchamp
    Apr 30, 2020, 5:10 PM
  • RE: read csv-data and put it in an array

    @sdetweil said in read csv-data and put it in an array:

    if u install the logging module I suggested, then it captures all the messages from the modulename.js in the browser and prints them to the terminal window log, which would be saved to the file as well.

    so i also can do (?):
    npm start dev
    in the window on the right klicking on “console”. there i see a lot of massages coming from console/moduls
    and then i can use your module to lock out other modules (?) …

    posted in Utilities
    P
    Perlchamp
    Apr 30, 2020, 5:06 PM
  • RE: read csv-data and put it in an array

    ok, it’s slowly dawning on me, see little light at the end of the tunnel

    posted in Utilities
    P
    Perlchamp
    Apr 30, 2020, 4:48 PM
  • RE: read csv-data and put it in an array

    always my pleasure

    posted in Utilities
    P
    Perlchamp
    Apr 30, 2020, 4:37 PM
  • RE: read csv-data and put it in an array

    thank you. ok, i will test …

    only for your information:

    start() {
    		console.log(`Starting module helper: ${this.name}`);
    	},
    
    	stop(){
    		console.log(`Stopping module helper: ${this.name}`);
    	},
    

    this is from your SampleModule. i’m not here to reprimand you. it should only be information. so please do not misunderstand.

    posted in Utilities
    P
    Perlchamp
    Apr 30, 2020, 4:34 PM
  • RE: read csv-data and put it in an array

    hallo sam :-)
    i have now this in my node_helper.js:

    var NodeHelper = require("node_helper");
    
    // add require of other javascripot components here
    // var xxx = require('yyy'); here
    const csv = require("csvtojson");
    const csvFilePath = this.path + 'birthdaylist.csv';
    
    
    module.exports = NodeHelper.create({
    
    	init(){
    		console.log("init module helper perlchamp");
    	},
    
    	start() {
    		console.log("Starting module helper: ${this.name}");
    		console.log("dieser Pfad: ${this.path}");
    		
    		csv()
    		.fromFile(csvFilePath)
    		.then((jsonObj)=>{
    			console.log(jsonObj);
    		})
    
    	},
    
    /*
    	stop(){
    		console.log(`Stopping module helper: ${this.name}`);
    	},
    */
    	// handle messages from our module// each notification indicates a different messages
    	// payload is a data structure that is different per message.. up to you to design this
    	socketNotificationReceived(notification, payload) {
    		console.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload);
    		// if config message from module
    		if (notification === "CONFIG") {
    			// save payload config info
    			this.config=payload
    			// wait 15 seconds, send a message back to module
    			setTimeout(()=> { this.sendSocketNotification("message_from_helper"," this is a test_message")}, 15000)
    		}
    		else if(notification === "????2") {
    		}
    
    	},
    
    });
    

    terminal says:

    Unhandled rejection Error: File does not exist. Check to make sure the file path to your csv is correct.
        at /home/dirk/MagicMirror/node_modules/csvtojson/v2/Converter.js:81:37
        at suppressedCallback (fs.js:209:5)
        at FSReqCallback.oncomplete (fs.js:153:23)
    

    it’s from your SampleModule …

    1. how can i see the console.log statements in the browser, starting MM ?
    2. did i enter the code in the right place?
    3. if I enter the following into the terminal window:
      node console.log (‘path: $ {this.path}’)
      i got an error message:
      bash: Syntaxerror unexpected word `(’
      what am I doing wrong ?

    many thanks in advance

    posted in Utilities
    P
    Perlchamp
    Apr 30, 2020, 4:13 PM
  • RE: read csv-data and put it in an array

    ok thank.
    if i want to test

        readCSV: fs.readFile('birthdaylist.csv', 'utf8', function (err, data) {
    	var dataArray = data.split(/\r?\n/);
    	Log.log(dataArray);
    
    

    or

    readList: function() {
    	var JFile=require('jfile');
    	var myF=new JFile("MMM-birthday.txt");
    	myF.lines // ["first line","second line"]
    

    i have to do this in node_helper right? and first i have to require them and of course to install them … something i forgot ?

    posted in Utilities
    P
    Perlchamp
    Apr 30, 2020, 12:49 AM
  • RE: read csv-data and put it in an array

    @sdetweil said in read csv-data and put it in an array:

    I open browser from PC to the mirror URL and do it there
    I debug from my PC, ssh connected to pi, or I run MM on my PC… and debug there

    how ?

    posted in Utilities
    P
    Perlchamp
    Apr 30, 2020, 12:32 AM
  • RE: read csv-data and put it in an array

    AND:
    thanks a lot for YOUR time. i hope it will not been wasted … i will working hard to get some results …

    posted in Utilities
    P
    Perlchamp
    Apr 29, 2020, 7:58 PM
  • 1 / 1
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