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

    Posts

    Recent Best Controversial
    • Mat's mirror completed!

      Hi all, it has taken a while for me, particularly as I was making the mirror for my wife as a surprise so keeping it under wraps in my workshop was difficult. Plus we had a baby in the meantime which really puts a stopper in workshop projects. But here it is:
      0_1475070497695_2016-09-28 20.46.20sml.jpg

      A quick run down of what I used:
      0_1475070977913_2016-09-26 21.55.34sml.jpg
      Raspberry Pi 3
      Lenovo ThinkVision LT2323p 23" - no HDMI input, but I bought a HDMI to DVI cable and it did the job nicely
      Belkin power adapter with usb power ports. Kept all of the monitor and Pi power internal.
      You may notice that the monitor is kept in place by two L-brackets - spares from building Ikea bookshelves (they’re used to stop the bookshelf being pulled over). They came in very handy!
      Velcro cable ties, Velcro dots and some double sided tape to keep everything on the back of the frame and monitor.
      Speaking of the frame, just used Pine boards, butt jointed into the frame and then topped it with oak beading for a bit of decoration. That really came up a treat!
      0_1475071376330_2016-08-30 22.04.48sml.jpg
      Painted with a water based enamel white.
      Had the glass cut to size and then used 97% mirror film for the mirror. There are tiny air bubbles in the mirror, but only if you are up close. I may redo that some time down the track
      Oh and I put it on the wall with a monitor wall stand which just slots in to attachment on the wall. As my monitor frame was quite deep, I had to do some Macgyver action with the wall plate. Utilised an offcut from my workshop tool bench frame that I made last summer.
      0_1475071346019_2016-09-26 21.55.53.jpg
      So there you have it. It was a fun project, my wife likes it and I’m ready for another challenge (although we have enough with two little ones to look after for the moment)…
      Mat
      0_1475071830720_2016-09-28 20.45.02sml.jpg

      posted in Show your Mirror
      zydecat74Z
      zydecat74
    • Wind Direction (Compass Points)

      One aspect of the weather module I found was missing was the wind direction. Open Weather produces a wind direction as a number in degrees, however I prefer the compass points.

      For anyone interested in my code in the currentweather.js file:

      1. For the main display of wind speed and direction (I’ve also got rid of the Beaufort speeds and changed it back to km/h) my code is as follows:
      var windSpeed = document.createElement("span");
      windSpeed.innerHTML = " " + this.windSpeed + "km/h " + this.windDirection;
      small.appendChild(windSpeed);
      
      1. In the “processWeather” function I have the following:
      processWeather: function(data) {
      		this.temperature = this.roundValue(data.main.temp);
      		this.windSpeed = this.roundValue((data.wind.speed)* 60 * 60 / 1000);
      		this.windDeg = data.wind.deg;
      		this.windDirection = this.deg2dir(this.windDeg);
      		this.weatherType = this.config.iconTable[data.weather[0].icon];
      

      From this function I removed the coversion to the Beaufort scale and added a windSpeed variable to convert metres per second to km/h. Then I have two lines, one giving me the current wind direction in degrees (windDeg) and windDirection which I convert below…

      1. My deg2dir function is a simple nested array which converts the numerical degrees value into a compass point direction:
      deg2dir: function(windDeg) {
      		var degrees = [[11.25,"N"],[33.75,"NNE"],[56.25, "NE"],[78.75, "ENE"],[101.25, "E"], [123.75,"ESE"], [146.25,"SE"],[168.75, "SSE"],[191.25,"S"],[213.75, "SSW"],[236.25, "SW"],[258.75, "WSW"],[281.25,"W"],[303.75,"WNW"],[326.25,"NW"],[348.75,"NNW"],[360, "N"]];
      			for (var i=0; i<degrees.length; i++) {
      			var direction = degrees[i][0];
      			if (direction > windDeg) {
      				return degrees[i][1];
      			}
      		}
      		return "";
      	},
      

      Hope this is of use to someone who is looking for alternative data to display.

      Cheers,

      Mat

      Note from Moderator: Please use Markdown on code snippets for easier reading.

      posted in Utilities
      zydecat74Z
      zydecat74
    • RE: Wind Direction (Compass Points)

      It seems that since I have updated my mirror to the live version 2 (was working on v2-beta for some time) that there has been very similar code included in the latest version to cater for wind direction, as well as the option to not use the Beaufort scale for wind speed.

      I’ll have to come up with some new code to blow your minds with…

      Cheers,

      Mat

      posted in Utilities
      zydecat74Z
      zydecat74
    • 1 / 1