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

    k3rn3lpanic

    @k3rn3lpanic

    0
    Reputation
    471
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    k3rn3lpanic Unfollow Follow

    Latest posts made by k3rn3lpanic

    • RE: txt-file-include doesn´t work

      @strawberry-3-141 i´ve changed the path in the node-helper.js, but it doesn´t solve my problem…
      Are there any other opportunities?

      const NodeHelper = require("node_helper");
      const fs= require("fs");
      
      module.exports = NodeHelper.create({
      
              socketNotificationReceived: function(notification, payload) {
                      if(notification === "START"){
                              this.config = payload;
                              this.readData();
                              setInterval(() => {
                                      this.readData();
                              }, this.config.updateInterval);
                      }
              },
      
              readData: function(){
                      fs.readFile("modules/MMM-OEBBv2/daten.txt", "utf8", (err, data) => {
                              if (err) throw err;
                              this.sendSocketNotification("DATA", data);
                      });
              }
      });
      
      

      kind regards
      k3rn3lpanic

      posted in Troubleshooting
      K
      k3rn3lpanic
    • txt-file-include doesn´t work

      Re: .txt file include

      Hi strawberry 3.141,
      i´ve read your interesting threat with regard to including textfiles.

      Your posted solution doesn´t work for me, and im searching why and i don´t find any failure…

      MMM-OEBBv2.js:

      Module.register("MMM-OEBBv2",{
              defaults: {
                      updateInterval: 30 * 60 * 1000 //reads the file every 30 mins
              },
      
              start: function(){
                      this.sendSocketNotification("START", this.config);
              },
      
              socketNotificationReceived: function(notification, payload) {
                      if(notification === "DATA"){
                              this.dataFile = payload;
                              this.updateDom();
                      }
              },
      
              getDom: function(){
                      var wrapper = document.createElement("div");
                      if(this.dataFile){
                              wrapper.innerHTML = this.dataFile;
                      } else {
                              wrapper.innerHTML = "No Data!";
                      }
                      return wrapper;
              }
      });
      

      node-helper.js:

      const NodeHelper = require("node_helper");
      const fs= require("fs");
      
      module.exports = NodeHelper.create({
      //here comes the part of the nodehelper after the 3 dots as posted above
      
              socketNotificationReceived: function(notification, payload) {
                      if(notification === "START"){
                              this.config = payload;
                              this.readData();
                              setInterval(() => {
                                      this.readData();
                              }, this.config.updateInterval);
                      }
              },
      
              readData: function(){
                      //to read a file to do the following
                      fs.readFile("daten.txt", "utf8", (err, data) => {
                              if (err) throw err;
                              this.sendSocketNotification("DATA", data);
                      });
              }
      });
      

      daten.txt:

      WB 912 um 13:00 von Bahnsteig 6A-C
      S 2 um 13:04 von Bahnsteig 5A-C
      REX 4410 um 13:04 von Bahnsteig 8A-C
      

      On the mirror always “No Data!” is shown.
      Please help me…

      Kind regards

      posted in Troubleshooting txt file include
      K
      k3rn3lpanic
    • Development MMM-OEBB Austrian Railway Info

      Hi there,

      i´ve been looking for method to show the latest railway information on the mirror, there is no official data API at the Austrian Railway Corporation ÖBB. Based on the work of Frederic Köberl i´ve installed his php script and set it up to run. It´s not the problem to find connections, at the moment i have to start a php script at the terminal and it echos the needed connection info. It´s already formated well, the one and only question is: how to bring this information into a module.

      My idea: copy for example the default/helloworld module - but to show instead of the static text, a variable of the php script should be shown.

      Can anybody help me plz…

      Kind regards
      k3rn3lpanic

      posted in Development
      K
      k3rn3lpanic