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

    Posts

    Recent Best Controversial
    • RE: Trying to write my own Module...

      MMM-EMonitor.js

      Module.register ("MMM-EMonitor", {
      
          //default module config.
          defaults: {
              // Insert defaults here
              interval: 900000, // Every 15 mins
              security_key: null,
              animationSpeed: 1000
          },
      
          getStyles: function() {
              return ["MMM-EMonitor.css"];
          },
      
          // Define the start sequence
          start: function() {
              Log.log("Starting module: " + this.name);
              this.loaded = false;
              this.xml = null;
              this.url = 'https://api.emonitor.us/location/getCurrentData?security_key=';
              setInterval(this.getCurrentData(), this.config_interval);
          },
      
         getCurrentData: function() {
              var self = this;
              var xhttp = new XMLHttpRequest();
              xhttp.onreadystatechange = function() {
                      if (this.readyState == 4 && this.status == 200) {
                              self.xml = self.parseXML(this.responseText);
                              self.loaded = true;
                              self.updateDom(self.config.animationSpeed);
                      }
              };
              xhttp.open("GET", this.url+this.config.security_key, true);
              xhttp.send();
          },
      
      
         getDom: function(){
              var wrapper = document.createElement("div");
              if(!this.loaded) {
                      wrapper.innerHTML = "Loading...";
                      return wrapper;
              }
              if(this.xml !== null){
               var table = document.createElement("table");
               table.classList.add("xsmall", "table");
               var channels = this.xml.getElementsByTagName("channel");
               for(var i = 0; i < channels.length; i++){
                 var row = document.createElement("tr");
                 for(var n = 0; n < channels[i].children.length; n++){
                      if(channels[i].children[n].tagName === "name" || channels[i].children[n].tagName === "watts"){
                      var element = document.createElement("td");
                      element.classList.add(channels[i].children[n].tagName);
                      element.innerHTML = channels[i].children[n].textContent;
                      row.appendChild(element);
                      }
                 table.appendChild(row);
                 }
               }
               wrapper.appendChild(table);
              } else {
                      console.log("Returned no Data");
                      wrapper.innerHTML = "NO DATA";
              }
              return wrapper;
         },
      
         parseXML: function(xmlStr){
              return ( new window.DOMParser() ).parseFromString(xmlStr, "text/xml");
         }
      
      });
      

      Your config.js should have:

      {
                              module: 'MMM-EMonitor',
                              position: 'top_left',
                              config: {
                                      security_key: 'XXXXXXXXXXXXXXX'  //your security key
                              }
                      }
      

      This just displays everything in a large table. You may want to modify the for loop to not display data when the wattage is 0, that should get rid of a bunch of rows.

      posted in Development
      mochmanM
      mochman
    • RE: MMM-Gas

      @rob73 I haven’t tried this to see how it looks, but you may just be able to comment out a few of the lines in MMM-Gas.js
      Try commenting out the last 2 lines of this code in the getDom() function.

       var td5 = document.createElement("td");
       td5.innerHTML = dist;
       TDrow.appendChild(td5);
       weatherTable.appendChild(TDrow);
      

      It should look like this when you’re done.

      var td5 = document.createElement("td");
      td5.innerHTML = dist;
      //TDrow.appendChild(td5);
      //weatherTable.appendChild(TDrow);
      

      You should also comment out this part as well.

      var bjumpy = document.createElement("th");
      bjumpy.setAttribute("style", "text-align:center");
      bjumpy.classList.add("xsmall");
      bjumpy.innerHTML = "Distance";
      //xFCRow.appendChild(bjumpy);
      //weatherTable.appendChild(xFCRow);
      
      posted in Transport
      mochmanM
      mochman
    • RE: Weather based on another provider..

      Or just get the new MagicMirror 2.0.2 that was released today. It has those changes incorporated.

      posted in Requests
      mochmanM
      mochman
    • RE: Nubie question... How do I kill magic mirror so that I test new settings for config.js

      Right, the nohup command removes the process from the terminal window. If you shut down the terminal, it’ll also shut down your magic mirror without the nohup command before npm.

      posted in Troubleshooting
      mochmanM
      mochman
    • RE: MMM-Swipe - Hand gestures

      I updated the module to also let you use it as a physical button. Besides sending notification, you can also have it activate another GPIO pin as a momentary press. I’m thinking about integrating it with either Alexa (which looks for a button press) or @EoF’s Hide All Module.

      posted in Utilities
      mochmanM
      mochman
    • RE: ipWhitelist HowTo

      Have you tried adding "10.0.0.1/24" to the list since it looks like your client is using an IPv4 connection?

      posted in Tutorials
      mochmanM
      mochman
    • RE: Weather based on another provider..

      @cowboysdude said in Weather based on another provider..:

      @mochman said in Weather based on another provider..:

      Or just get the new MagicMirror 2.0.2 that was released today. It has those changes incorporated.

      That’s awesome! Thank you but I just got weather underground working and I like it :)

      Yeah it does, that’s the one I use too.

      posted in Requests
      mochmanM
      mochman
    • RE: Calendar config

      Try putting your config.js in a website like http://jshint.com/. It should help you find any brackets you might be missing.

      posted in Troubleshooting
      mochmanM
      mochman
    • RE: ipWhitelist doesn't work for me

      @DazDavid Yeah, I messed up with the CIDR notation for IPv6. The reason why “/24” works is because that gives you practically every IP (especially every IP4 address). If you want to just have 192.168.X.0 - 192.168.X.255 whitelisted, you should use "::ffff:192.168.X.1/120".

      I added a HOWTO guide here to help out everyone.

      posted in Bug Hunt
      mochmanM
      mochman
    • RE: MMM-Nest

      @tidus5 Thanks! I’m terrible at CSS, I just keep changing numbers until it looks right to me.

      posted in Utilities
      mochmanM
      mochman
    • RE: Magic Mirror With Amazon Alexa

      AlexaPi works pretty well too (once you get the sound to work). It has a wake word in case you don’t have a button to press. There is a Magic Mirror Module for it as well that displays what Alexa is doing on the pi (listening, speaking, errors, thinking, etc…).

      posted in Requests
      mochmanM
      mochman
    • RE: Calendar config

      @JbeesonMagic16 No, it’s a general javascript problem finder. If you paste your config.js file in it’s entirety into http://jshint.com/. You should see it say “One undefined variable”. If you see

      Expected '}' to match '{' from line XXX and instead saw ']'
      

      You are missing a bracket. Look at line XXX and then follow the code down to see where the missing bracket is.

      posted in Troubleshooting
      mochmanM
      mochman
    • RE: MMM-Nest

      I updated the css using edits from @j-e-f-f. The nest display looks closer to what the actual nest thermostat looks like. 0_1496072888357_nest.png

      posted in Utilities
      mochmanM
      mochman
    • RE: Mochman's first mirror

      Don’t judge me too harshly but I here’s what the back looks like. Lots of tape, hot glue, and wires.

      0_1470334044694_back.jpg

      posted in Show your Mirror
      mochmanM
      mochman
    • RE: Where to run a Script?

      Okay I thought you were using alexaPi, looks like alexa-client. In that case, have you run

      cd /home/pi/MagicMirror/alexa-client/
      pip install -r requirements.txt
      python setup.py install
      sudo pip install -r auth_web_requirements.txt
      

      already? If so, try

      cd /home/pi/MagicMirror/alexa-client/
      python auth_web.py
      

      In this application you will need to add the token you get from the website to your settings.py file. After you get the token, run nano settings.py and paste the token where it says

      REFRESH_TOKEN= ``
      

      so it will say something like

      REFRESH_TOKEN= `yourTokenGoesHere`
      
      posted in Troubleshooting
      mochmanM
      mochman
    • RE: MMM-Nest

      @caseyrcoughlin It might be possible, but how would someone select the up/down arrows, etc? Are you setting up a touch screen mirror?

      posted in Utilities
      mochmanM
      mochman
    • RE: Mochman's first mirror

      @Mitchfarino According to this article, putting Alexa on the pi makes is usable wherever you are.

      posted in Show your Mirror
      mochmanM
      mochman
    • RE: Applied change to config.txt, MM fails to boot.

      I had the same issue. I changed dtoverlay=vc4-kms-v3d to dtoverlay=vc4-fkms-v3d and was able to boot up again.

      posted in Troubleshooting
      mochmanM
      mochman
    • RE: I'm back!

      @MichMich Welcome back!

      posted in General Discussion
      mochmanM
      mochman
    • RE: MMM-Swipe - Hand gestures

      @Mitchfarino

      Your left sensor

      Vcc goes to pin #2
      Gnd goes to pin #6
      Trig goes to physical pin #26 (Which is labeled GPIO 23)
      Echo goes to physical pin #18 (Which is labeled GPIO 24)

      Your right sensor

      Vcc goes to pin #4
      Gnd goes to pin #9
      Trig goes to physical pin #22 (Which is labeled GPIO 25)
      Echo goes to physical pin #37 (Which is labeled GPIO 26)

      You need both sensors if you want to detect movement.

      posted in Troubleshooting
      mochmanM
      mochman
    • 1
    • 2
    • 3
    • 2 / 3