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

    Posts

    Recent Best Controversial
    • RE: error loop

      Well, the error information are pretty clear, you just need to look at your code to come to a conclusion. Without seeing the code, we can’t know anything about why these errors occur.

      1st says there’s no element by the class name you’re searching for. Either it’s not there or you’re looking in the wrong place.

      2nd says you’re trying to append something that is not an element. You can’t append a string, for example.

      For example, that’s a string and won’t work:

      let parent = document.getElementById("parent");
      let element = "<div>lorem ipsum</div>";
      parent.appendChild(element);
      

      This will work:

      let parent = document.getElementById("parent");
      let element = document.createElement("div");
      element.innerHTML = "lorem ipsum";
      parent.appendChild(element);
      
      posted in Development
      D
      doubleT
    • RE: How to develop modules

      I’d second that.

      For a quick overview:

      The DOM (all visible elements) is based on HTML, styled with CSS and usually filled with content and function by Java Script. That’s all you need for basic modules.

      If you go further, you’ll need Python in case you have something connected to the Pi andnodeJS for advanced modules with some backend code, like API calls, though some nodeJS knowledge will help you a lot to understand the whole structure in the first place.

      jQuery can be a helpful Java Script library.
      API calls usually deliver JSON or – rarely – XML, but both should be familiar if you know JS objects and arrays and HTML.

      As Sean said, playing around and manipulating existing modules should help you a lot. Go through the code, see if you understand the connections and find out what happens if you manipulate it.

      Your most important tool when working in js-files is the browser console where you can print to with the js code console.log("show me the content of var x: " + x); MM code Log.info("show me the content of var x: " + x);

      posted in General Discussion
      D
      doubleT
    • RE: Really confused

      Sorry if this sounds a bit harsh, but to be honest, that’s an easy one that you can answer yourself with all the information you have in this thread already. You’re making the same mistake as yesterday.

      Hint: Check where you are. Use “ls” (list content of current directory) and “cd”. Learn to read the path to know where you are.

      posted in Troubleshooting
      D
      doubleT
    • RE: Default newsfeed - make list?

      @Pade2204 said in Default newsfeed - make list?:

      Im not good to see, where you edit those things you have made? Can you make a dummy guide for me? hehe :)

      Sure, but I’d suggest reading – and learning – about the basics of JavaScripts first, or this could get a bit complicated.

      I worked directly in the default newsfeed module, which I’d absolutely not suggest doing. a) This could break the default module and you have to rebuild the code. b) With the next update, the code will be reset to its original state and your changes are lost.

      Having said that, to experiment with this module, I changed the /MagicMirror/modules/default/newsfeed/newsfeed.js that I opened in an editor. You’ll see the functions I mentioned above. Note that I commented where the original code of a function was left untouched. In the getDom: I put some part of the original code with the else { } part of an if statement.

      EDIT: I made a git repository of the changes I made. You can look at my code here: https://github.com/TTigges/newsstack/blob/master/newsfeed.js

      posted in Requests
      D
      doubleT
    • RE: wrapper.innerHTML

      I was interrupted when I wrote my answer and forgot to add what I was initially going to say. I decided to write a new reply instead of editing the above, not to confuse anyone and keep the two apart.

      There is another way to update the content of an element (that has been created in getDom before):

      Example 3, .innerHTML:

      start: function() {
      // stays the same as above
          setTimeout(function() {
              this.magicContent(self);  // this will call the function "magicContent"
          }, 10 * 1000);                // 10 seconds after the start, 5 seconds after "buildContent"
      },
      // we don't touch getDom or buildContent!
      magicContent: function() {
          document.getElementById("my-content").innerHTML = "Changed <i><b>yet again!";
      }
      

      document.getElementById(“my-content”).innerHTML = “content”; will update the selected element (the div with the id “my-content”) with the selected content without having to call updateDom().

      Keep in mind that this will only work on elements that were created before in getDom, so it will not work within start: function() …

      Caution! This can also update elements of other modules, so be careful and use unique IDs.

      posted in Troubleshooting
      D
      doubleT
    • RE: How to add modules. For absolute beginners.

      A good one. :) www.sublimetext.com

      posted in Troubleshooting
      D
      doubleT
    • RE: GasBuddy

      I did some digging but wasn’t able to find a usable alternative.


      Company Website (& API)
      I don’t know if the website is down or geo-blocked for me, I can’t reach www.speedway.com
      If I could, I’d check if they have pages for each station with live prices available and if they have an API.


      Google Knowledge Graph
      I searched that station on Google and found the result page had a right hand sidebar (Google Knowledge Graph) with live prices. So I thought I could get it via the Knowledge Graph API (if you have a Google Dev API key (and activated KG), you can try it with this link) but the itemList is empty, or maybe I did something wrong. Wrong queries?


      Google Maps – or Places?
      Then I found out that when you search that station on Google Maps, it’ll also show the live prices in the sidebar on the left. But the latest info I found (some months old) say that there’s no way to access these as they’re not in the Google Maps API (or was it Places?).


      Getting the live price from the actual gas station itself, or at least from Google, would be the best solution, as the GasBuddy price is not really live, it’s only updated when a user shares the newest price.

      posted in Requests
      D
      doubleT
    • RE: Changing compliments

      @Stacy said in Changing compliments:

      @lavolp3 so how do I get to the modules to change them?

      All the modules get their information from the config.js cruunnerr and Mykle mentioned. You don’t need to change anything in the module folders.

      If the module code is broken at the moment, you can rebuild it from – or completely replace it with – the original here if you don’t want to start over again.

      This is the basic code for the compliment module to be added/changed/edited in the MagicMirror/config/config.js :

          {
              module: "compliments",
              position: "lower_third",	// This can be any of the regions.
                                              // Best results in one of the middle regions like: lower_third
              config: {
                  compliments: {
                      anytime: [
                          "Hey!",   // properties are followed by commas – most common mistake
                          "Hello."  // last property within brackets doesn't get a comma
                      ],
                      morning: [
                          "Hey!"
                      ],
                      evening: [
                          "Hey!"
                      ]
                  }
              }
          } // add a comma (,) if another module's config is following
      

      See the comments in the code. The most common mistakes are missing commas or missing brackets.

      posted in Troubleshooting
      D
      doubleT
    • RE: Need help with internet monitor-module

      That doesn’t make sense, the functions are expecting integer and boolean, not strings.

      But maybe I found something while checking the module’s readme for the variables and default config:

      “Please note that updateInterval has to be greater than maxTime”

      https://github.com/ronny3050/internet-monitor

      posted in Troubleshooting
      D
      doubleT
    • RE: Timetable with (almost) static data

      Actually, I wasn’t really thinking about loading a page and displaying it (in an iFrame) but I rather looked at the questions of loading file contents and suggested the runner.exec child process because php was specifically mentioned (I don’t think PHP is necessary at all).

      If we’re talking about HTML, I’d agree with you (also without testing, though). But for PHP within Node.js: That won’t work, you’d have to have a PHP server running parallel to node and address it, etc. My suggestion (runner.exec child_process) doesn’t run a server but executes that one file with PHP and returns what it parsed.

      posted in Requests
      D
      doubleT
    • 1
    • 2
    • 3
    • 4
    • 5
    • 3 / 5