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

    Posts

    Recent Best Controversial
    • RE: http request

      Make sure that you’re not just copy and pasting blindly into your config file.

      After each

      modules: [
      {
      etc
      },
      

      Note the comma , after the module. That comma should only be there if there are more modules.

      Likewise, if you’re pasting it last, you need to make sure the module before it has one, to let the script know there are more modules after the previous one.

      So the pattern is

      modules: [
      {
         module: ‘firstModule’,
         config: {
         option : ""
         }
      }, <<< COMMA HERE
      
      modules: [
      {
         module: ‘middleModule’,
         config: {
         option : ""
         }
      }, <<< COMMA HERE
      
      modules: [
      {
         module: ‘last module’,
         config: {
         option : ""
         }
      } <<<<< NO COMMA
      

      hope that makes sense. hopefully that’s the problem.

      posted in Development
      E
      Eunanibus
    • RE: http request

      Sorry, I made a lot of mistakes on the README it seems.

      Instead of

      accessToken : "http://etc"
      

      use

      httpRequestURL: "http://etc"
      

      apologies

      posted in Development
      E
      Eunanibus
    • RE: http request

      Awesome. @KirAsh4 is correct - The README has all the instructions so be sure to take a look.

      Please let me know how it works cause you’ll be the first person to use it

      posted in Development
      E
      Eunanibus
    • RE: MMM-HTTPRequestDisplay

      Thank you :wink: - I hope it’s useful to someone. It needs some work so I’ll probably revisit it soon.

      But right now I’m working on a new module to give to everyone. And it’s even cooler :stuck_out_tongue: - I actually think a lot of people will use it.

      posted in Utilities
      E
      Eunanibus
    • RE: http request

      Cool. It should work fine! Hurry up and try it, I made it for you :laughing:

      More information about it is here - I posted it for everyone to download.

      posted in Development
      E
      Eunanibus
    • RE: Debugging

      It’s my source code :laughing: - My object should have an available function to me, but it’s coming up function not found. I’m gonna keep digging! New module is on its way.

      posted in Development
      E
      Eunanibus
    • RE: Debugging

      Sorry to keep on this. Is there a particular way I’m able to look at a particular object’s available functions in console (if there is a way, I can’t see it and google is turning up zilch)

      posted in Development
      E
      Eunanibus
    • MMM-HTTPRequestDisplay

      I created this to help another member @acdacd2 but I figure it can be universally used. Many thanks to @KirAsh4

      It is available here: https://github.com/Eunanibus/MMM-HTTPRequestDisplay

      This is not only my first module, but it’s my first real venture into JavaScript, before this I’ve not really had any experience.

      The module allows a targetURL that responds with XML data to be displayed on the mirror. This hopefully supposed to be useful to anyone with any kind of home automation or sensor data that can be received via a HTTP request. In theory, one might be able to get a read out on say; all the doors that are locked in a house.

      I’m not sure. It’s very choppy, and needs some serious work. Right now it only inspects one node hierarchy down. I’d like to improve that in the future.

      Below, is an example using the OpenWeather API to make a request.

      alt text

      alt text

      alt text

      posted in Utilities
      E
      Eunanibus
    • RE: My Setup (or: How crazy I am)

      Well thanks to you, I’ve managed to create a semi-functional first module for another user :)

      posted in Development
      E
      Eunanibus
    • RE: http request

      Well, I’ve spent the last couple of evenings trying to build something for you. You can download it here.

      Give it a try and let me know how it does for you.

      posted in Development
      E
      Eunanibus
    • RE: My Setup (or: How crazy I am)

      Haha. Well it very much helped me, convoluted or not.

      But in any case, since electron is essentially a html browser, you can refresh and use a console just like any other browser, which is actually something I didn’t know prior (F5 on Windows and ⌘+R on a Mac)

      So with that said, I simply work on my files on my local system and push them to the Raspberry Pi.

      Using “npm start” allows me to launch the application on my system, and using “⌘⌥ + I” brings up the console allowing me to debug.

      I actually prefer your method :smile: !

      posted in Development
      E
      Eunanibus
    • RE: http request

      Having good success. Can I get an example of the XML you’re trying to display?

      posted in Development
      E
      Eunanibus
    • RE: Debugging

      Your last post helped immensely! Thank you!

      posted in Development
      E
      Eunanibus
    • RE: http request

      Ok. I took a look at this last night and I’m getting somewhere so let me get back to you on this. I’m just trying to create the module for you.

      posted in Development
      E
      Eunanibus
    • RE: Debugging

      Even when writing console.log(’ ') nothing appears in the terminal, so I just assumed it was logging elsewhere.

      How are you accessing it via your browser?

      posted in Development
      E
      Eunanibus
    • RE: Debugging

      Thanks for your response. I’m still working on it (and something else for another member) - I’m still having trouble accessing/finding a log. For the most part, right now, I’m running the npm from my computer directly and using the electron app there.

      I’m not able to find any log file, or any tool that allows me to debug in real-time. Because of the nature of this app and the modules, it becomes a little more complex than just following instructions that I’ve seen/Any advice?

      posted in Development
      E
      Eunanibus
    • RE: http request

      I’m replying Mobile at the moment so I can’t give you a comprehensive answer (sorry) - does it say which line the error occurs?

      Ensure that the parseData function is not within the GetDom() method, but isolated on its own. Go through and ensure that the document.createElement(“div”) function is referencing a document.

      Sorry, I mocked up that code in about 10 minutes and I’m not an expert so there may be issues.

      posted in Development
      E
      Eunanibus
    • RE: http request

      Sure. So I’d probably go about it with this approach and work from there:

      Try starting with the HelloWorld module and work from there. I’d start with putting this in the GetDom() function and return the contents of whatever you want displayed in the wrapper by appending it.

      var wrapper = document.createElement("div");
      var xmlhttp = new XMLHttpRequest();
      var url = "http://ip:8889/status.xml";
      
      xmlhttp.onreadystatechange = function() {
          if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
              var results = JSON.parse(xmlhttp.responseText);
              wrapper.innerHTML = parseResults(results);
          }
      };
      xmlhttp.open("GET", url, true);
      xmlhttp.send();
      return wrapper;
      
      function parseResults(results) {
         var nodes = results.childNodes;.
         var resultsContainer = document.createElement("div");
          var out = "";
          var i;
          for(i = 0; i < results.length; i++) {
              var resultWrapper = document.createElement("div");
              resultWrapper.innerHTML = x[i].nodeName + ": " + x[i].childNodes[0].nodeValue + "<br>";
            resultsContainer.appendChild(resultWrapper);
          }
          return resultsContainer;
      }
      

      I’m a bit of a beginner too, but I think that might give you something to start with?

      posted in Development
      E
      Eunanibus
    • RE: Debugging

      Darn. That makes things a little more difficult.

      Any advice on how to approach that then? Since I have a dynamic 3D object that needs a rendering size to construct.

      I can keep it at a static size, allow config files to set it?.. Small, medium and large I guess?

      posted in Development
      E
      Eunanibus
    • RE: Debugging

      That makes sense. So then I guess I have 2 questions leading on from that:

      1. I’m attempting to create a dynamic 3d model but I need a height and width. Is there any way to retrieve the rendered height and width at runtime based on the resolution?

      2. Using a browser to go to the rip’s IP via the MM port sounds useful. How do I retrieve the rip’s IP/MM port?

      thanks again for the response

      posted in Development
      E
      Eunanibus
    • 1 / 1