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

    Posts

    Recent Best Controversial
    • RE: updateDom() blocks MagicMirror

      @sdetweil Do you remember my problem yesteray that my magic mirror doesn`t start? I started the program today in the morning. Without doing anythink since yesterday evening, the same error occurs.

      The only think I change was that I renamed lenght to length. Than I deleted the module module and copyed the new one.

      old post: https://forum.magicmirror.builders/topic/16233/error-while-starting-magic-mirror/29

      posted in Development
      1
      1BlauNitrox
    • RE: updateDom() blocks MagicMirror

      @sdetweil
      First: Is there an other option?

      Second: I added the getData() function in getDom()

              const wrapper = document.createElement("div");
              this.getData();
              if(this.response.lenght <= 0) {
                  wrapper.innerHTML = "No Entries";
              } else {
                  wrapper.innerHTML = JSON.stringify(this.response);
              }
              return wrapper;
      

      Now the mirror show UNDEFINED again

      posted in Development
      1
      1BlauNitrox
    • RE: updateDom() blocks MagicMirror

      @sdetweil What about JSON.stringify(this.response);

      posted in Development
      1
      1BlauNitrox
    • RE: updateDom() blocks MagicMirror

      @sdetweil Is there a Json parser I can use?

      posted in Development
      1
      1BlauNitrox
    • RE: updateDom() blocks MagicMirror

      @sdetweil
      response.PNG

      Not exectly what I wanted :joy:
      Why can getDom() not transfrom the array in a readable string?

      posted in Development
      1
      1BlauNitrox
    • RE: updateDom() blocks MagicMirror

      @sdetweil I changed getDom() to this:

      getDom: function() {
              const wrapper = document.createElement("div");
              if(response.lenght <= 0) {
                  wrapper.innerHTML = "No Entries";
              } else {
                  wrapper.innerHTML = this.response;
              }
              return wrapper;
      	},
      

      There is a check if the array has any entries.

      But the mirror shows “undefined”

      posted in Development
      1
      1BlauNitrox
    • updateDom() blocks MagicMirror

      Hey,

      I am developing my own first module. Therefore I looked at some other modules and in the dev documentation.

      This is what I have right now:

      Module.register("MMM-VPlan", {
      	defaults: {
      		fadeSpeed: 2,
                      username: "",
                      password: ""
      	},
      
      	getStyles: function() {
              return ["MMM-Plan.css"];
      	},
      
          start: function() {
      		Log.log("Starting module: " + this.name);
      		
              this.response = {
                  "name": "Test",
                  "entries": {
                      "lessions": "Teacher Subject Room representation"
                  }
              };
      
      		//this.getData();
              updateDom();
      	},
      
      	getDom: function() {
              const wrapper = document.createElement("div");
              wrapper.innerHTML = response;
              return wrapper;
      	},
      
          getData: function () {
              const request = new XMLHttpRequest();
              request.open('GET', 'http://localhost/vplan/' + username + '/' + password + '/today', true);
              request.onreadystatechange = () => {
                if (request.readyState != 4) {
                  return;
                };
          
                if (request.status === 200) {
                  this.response = JSON.parse(request.response);
                  this.updateDom();
                } else {
                  Log.error(`${this.name}: Could not load data`);
                }
          
                setTimeout(() => this.getData(), this.config.updateIntervalMs);
              };
              request.send();
            },
      })
      

      The getData() function is not in use.

      My problem is the getDom() function. If I call updateDom() in the start method, the mirror shows only a black screen without any content. Even the other modules aren`t visible.
      If I delete updateDom() in the start methode, the mirror shows all modules. But my module returns undefined:

      Undefined.PNG

      posted in Development
      1
      1BlauNitrox
    • RE: Error while starting Magic Mirror

      @sdetweil It works btw

      posted in Development
      1
      1BlauNitrox
    • RE: Error while starting Magic Mirror

      @sdetweil I will do

      posted in Development
      1
      1BlauNitrox
    • RE: Error while starting Magic Mirror

      @1blaunitrox I will remove the MagicMirror software with all of its modules and install it new

      posted in Development
      1
      1BlauNitrox
    • 1 / 1