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

    Posts

    Recent Best Controversial
    • RE: Weather Underground Forecast (wuforecast)

      UPDATED MODULE - “Git” module here

      @desq OK, added an option for the degree symbol (I have a small screen and not a mirror, so I don’t like it on mine). I also am now using the “weathericons” from the standard module. :)

      • Option (degreeSym) to display/not display degree symbol
      • Icon set has been changed to “weathericons”
      • Removed the hard-coded resize on icons (forgot to remove during testing)
      • Fixed default cell padding for readability (you can customize through custom.css)

      Note: module is standard grey colors, custom colorization such as the screenshot can be done through custom.css
      alt text

      posted in Utilities
      M
      mattlugar
    • RE: Weather Underground Forecast (wuforecast)

      @RedNax Oh cool, didn’t even realize you could embed multiple API calls at the same time!!! :)

      posted in Troubleshooting
      M
      mattlugar
    • RE: Weather Underground Forecast (wuforecast)

      I was thinking about doing a dual-mod, but honestly there’s no advantage over having two separate mods. The json streams for the current weather and the forecast are separate on Weather Underground, so there’s no advantage on reducing the number of network/API calls. Secondly, it reduces flexibility as far as screen positioning of the mods goes (you’d have to keep them together in the same part of the screen).

      I’m pretty close to finishing my mod for getting current conditions from WU as well. I’m using JSON right now, but I’m trying to see if there’s a way to tap into the ‘realtime’ stream that they use for their flash gadgets that you can put on websites. Not sure if it is possible yet though.

      posted in Troubleshooting
      M
      mattlugar
    • RE: Weather Underground Forecast (wuforecast)

      BTW, some modifications I’m planning on:

      • Remove the hardcoded icon sizes (I forgot I had that in there).
      • Add option to show POP for all %'s (including 0)
      • Add option to select specific icon sets Underground Icon Sets
      • Add option to display predicted rain/snow amounts for the day

      There’s other data available from the API (written forecasts, wind speed predictions, humidity predictions, etc), so if there’s interest in finding ways to display that, let me know.

      posted in Utilities
      M
      mattlugar
    • RE: Weatherforecast Wunderground module question

      Posted!!! Let me know what you think.

      link text

      posted in Development
      M
      mattlugar
    • Weather Underground Forecast (wuforecast)

      This is my first attempt at a full-fledged module for Magic Mirror, so please let me know your feedback or ideas for additional functionality. Also, if I did the GitHub wrong, let me know!
      [card:MattLugar/wuforecast]
      This is modified from the weatherforecast module. It uses Weather Underground as the data source and also has the additional feature of providing the chance of precipitation if it is above 0%.
      alt text

      The color is not default, but can be modified through your custom.css, for example the above screenshot is set with:

      .wuforecast .max-temp {
        font-size: 27px;
        line-height: 27px;
        color: #f66;
      }
      
      .wuforecast .min-temp {
        font-size: 27px;
        line-height: 27px;
        color: #0ff;
      }
      
      .wuforecast .weather-icon {
        font-size: 27px;
        line-height: 27px;
        color: #f93;
      }
      
      .wuforecast .day {
        font-size: 27px;
        line-height: 27px;
        color: #6f6;
      }
      
      posted in Utilities weather
      M
      mattlugar
    • RE: Weatherforecast Wunderground module question

      I just finished getting it all coded up. The colors are simply css modifications (I can post how I did that in the README). About to grab some dinner then I’ll finish documentation and figure out how to set it up on GitHub.

      posted in Development
      M
      mattlugar
    • RE: News Ticker

      I think he’s talking the scrolling text like you see on TV (at least it is common here in the states). Can’t find a great solo gif of it, but here’s a gif of 17 different ones at the same time, lol… Hopefully enough to get the idea across. It might be a bit taxing on the pi architecture, not sure.

      alt text

      posted in Requests
      M
      mattlugar
    • RE: News Ticker

      That would be a cool idea… I was pondering doing something similar for a sports score stream (think what you see at the bottom of the screen on ESPN or something). I hadn’t found any good free sports json API that are still active so I hadn’t put any effort towards iet yet. It was a really quick google search so I might have missed something.

      posted in Requests
      M
      mattlugar
    • RE: Weatherforecast Wunderground module question

      I’ve modified the existing weatherforecast module to utilize weather underground… I’m utilizing the weather underground default icons for now. Not sure if it is something of interest for me to modularize or not?

      alt text

      posted in Development
      M
      mattlugar
    • RE: readFileSync

      @KirAsh4 Yeah, it is working for me as I want it. I figured it wouldn’t be overly useful to others anyhow since there was a lot of back-end work to do (namely setting up json streams that match the module code from the weather station, uploading to an appropriate location).

      Screenshot of my current display is below. It updates every 5 seconds using data from my local Davis weather station running Cumulus software. The rain information (total daily rain on top left, current rain rate at bottom left) only display if there has been rain today or it is currently raining respectively. It will also display winds like “12 G23” if the winds hit gust criteria (over 18MPH gusts and more than 10MPH over the wind speed). It is pretty trivial to put any information you can get into the json file to display.

      I’d be happy to try to properly modularize this if there is some interest, there’s just so many options and variations of stations/json exports/etc that I’m not sure I’d know where to start.

      alt text

      posted in Development
      M
      mattlugar
    • RE: Weatherforecast Wunderground module question

      I’m modifying for wunderground now too. I’m finding openweathermap horribly wrong sometimes (today they say showers here and every other forecast system says sun).

      posted in Development
      M
      mattlugar
    • RE: readFileSync

      Yeah, I went about it differently than I wanted to. I ended up porting everything to an apache directory so it serves itself as a webapp. Had a few bugs to work out (it was locking up if the json was in the middle of writing when it was retrieved) but I have it working and bug free now best I can tell :)

      posted in Development
      M
      mattlugar
    • RE: readFileSync

      That’s where my lack of knowledge on how to debug in this new environment was hurting me. Was able to figure out a better way to debug and now have something to work with.

      Uncaught ReferenceError: require is not defined
      

      Off to roll up my sleeves and do some mad google-fu.

      Thank you! :)

      posted in Development
      M
      mattlugar
    • readFileSync

      I’ll preface this by saying I’m fairly new at nodejs, so maybe I’m doing something totally stupid. I’ve been beating my head on this for a while now… Not making any sense to me whatsoever, googling like crazy and still totally stuck.

      I have bigger plans (reading a locally updated JSON file and displaying frequently updated data to the screen), but as nothing seemed to work I kept paring and paring the project back to where I’m now simply trying to display static contents of a local file to the screen. I altered helloworld to try to do this simple task. Note that the file ‘/home/pi/test.txt’ is simply the word “test”, and has permissions set to where anyone can read it. I’m also loading other modules just so I know something’s working.

      The following code locks up the mirror, displaying simply a black screen. Note that I am not even attempting to display the file at this point, I’m simply trying to load it into the variable ‘file’.

      Module.register("helloworld",{
      
              getDom: function() {
                      var wrapper = document.createElement("div");
                      var file = require('fs').readFileSync('/home/pi/test.txt', 'utf8');
                      wrapper.innerHTML = "Hello";
                      return wrapper;
              }
      });
      

      I can tell that the issue is my loading line because I can comment it out thusly and all the modules display, including the “Hello” text:

      Module.register("helloworld",{
      
              getDom: function() {
                      var wrapper = document.createElement("div");
      //              var file = require('fs').readFileSync('/home/pi/test.txt', 'utf8');
                      wrapper.innerHTML = "Hello";
                      return wrapper;
              }
      });
      

      OK, so maybe there’s a problem with my loading statement. Easy to check, copy/past the line into a js file and run it:

      test.js:

      var file = require('fs').readFileSync('/home/pi/test.txt', 'utf8');
      console.log(file);
      

      And here’s what happens:

      pi@lugarpi:~ $ nodejs test.js
      test
      

      Works perfectly fine in nodejs but if I put that line of code into the module it locks up the mirror. Am I missing something here? Also, I’m launching mirror through pm2. I understood any errors should show up in ~/.pm2/logs but the error log doesn’t show anything.

      posted in Development
      M
      mattlugar
    • RE: Load data from json file

      @paviro Ah, well thanks for the feedback. I’m hoping to get a bit of a hybrid between that app and pulling data from my own weather station. I’d like to keep the sunrise/sunset and the current conditions coming in from openweathermap and put my own station’s temp/wind. Was thinking modifying his would be a little easier than from scratch. :) Maybe I’ll get lucky and he’ll see this and point me in the right direction.

      posted in Development
      M
      mattlugar
    • RE: Load data from json file

      @paviro Difference on mine is I’m pulling in a straight value from a text file, not JSON. The file is a text file that has current temperature. No markups tags or anything else.

      I’m no expert at Java so maybe I’m missing something?

      posted in Development
      M
      mattlugar
    • RE: Load data from json file

      I’m not exactly in the same boat, but similar I guess… Maybe we can put our heads together or someone more knowledgeable will notice the thread…

      I’ve got a local weather station that I have putting plain text data (for temperature) on the SD card of MagicMirror . My goal is to put a ‘realtime’ (updated every minute or so) temperature on the display, directly from my own weather station.

      As an initial step to test this out, I went into currentweather.js and changed the following in the processWeather function:

      Removed:

      this.temperature = this.roundValue(data.main.temp);
      

      Added:

       var fs = new require('fs');
       this.temperature = fs.readFileSync('/var/www/html/wx/temp.txt');
      

      I anticipated that this would put the contents of my file in place of the temperature data from openweathermap. Unfortunately, it results in the currentweather module sticking at Loading...

      Just to check I’m not insane, I replaced my code with:
      this.temperature = '56.0';

      The module loads with 56.0 as the temperature. This leads me to believe I’m having an issue reading the file from disk. I threw together a quick js file to test I’m doing the fs.readFileSync command right:

      var sys = require("sys");
      var fs = new require('fs');
      var temp = fs.readFileSync('/var/www/html/wx/temp.txt');
      sys.puts(temp);
      

      Low and behold, my file contents show up just fine.

      As far as I can tell, this SHOULD work, but it clearly isn’t. Maybe you and I are running into similar issues reading from file? Anyone out there that can assist us?

      posted in Development
      M
      mattlugar
    • 1 / 1