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

jon11a

@jon11a

Managed to get my MagicMirror up and running and am pretty pleased with it. Such a great project.
Now using it to help learn more coding skills.

2
Reputation
554
Profile views
5
Posts
0
Followers
0
Following
Joined May 16, 2017, 12:55 AM
Last Online Apr 10, 2021, 1:40 PM
Age 46
Location Cumbria, UK

jon11a Unfollow Follow

Best posts made by jon11a

  • RE: MMM-MyCommute

    @j.e.f.f
    Managed to do it and pretty pleased with myself :)

    Here’s what it looks like:

    0_1496151228319_commute.png

    I had to edit the css file to move the destination-label slightly as you mentioned:

    margin-right: 70px;
    

    I edited your formatTime function to format the time in hours and minutes or just minutes if it’s less than an hour in total.
    Below is the code for that function with my bits added, I am sure it could be better but I think I did ok!

    formatTime: function(time, timeInTraffic) {
    
        var timeEl = document.createElement("span");
        timeEl.classList.add("travel-time");
        if (timeInTraffic != null) {
          var minutes = Math.floor(Number(timeInTraffic) /60);
          var h = Math.floor(minutes /60);
          var m = Math.floor(minutes %60);
          if (h == 0) {
            timeEl.innerHTML = m + " min";
          } else {
            timeEl.innerHTML = h + "h " + m + " min";
          }
          var variance = timeInTraffic / time;
          if (this.config.colorCodeTravelTime) {
            if (variance > this.config.poorTimeThreshold) {
              timeEl.classList.add("status-poor");
            } else if (variance > this.config.moderateTimeThreshold) {
              timeEl.classList.add("status-moderate");
            } else {
              timeEl.classList.add("status-good");
            }
          }
        } else {
          var minutes = Math.floor(Number(time) /60);
          var h = Math.floor(minutes /60);
          var m = Math.floor(minutes %60);
          if (h == 0) {
            timeEl.innerHTML = m + " min";
          } else {
            timeEl.innerHTML = h + "h " + m + " min";
          }
          timeEl.classList.add("status-good");
        }
    

    Thanks for your help Jeff, learned some more programming skills too so I’m happy! :)

    posted in Transport
    J
    jon11a
    May 30, 2017, 1:39 PM

Latest posts made by jon11a

  • Pushover.net integration with default Alert Module

    Hi all,
    I am just wondering if there was a way to integrate the pushover.net service so that messages sent from this were to be displayed on the mirror using the default Alert module?

    Currently I have pushover.net sending a message to my iphone and imac whnever someone rings the doorbell. Would be great for this alert to also pop up on my mirror.

    Does anyone know if it would be possible?

    Thanks!

    posted in Requests
    J
    jon11a
    Jul 16, 2017, 6:17 PM
  • Monzo Module Request

    Hi all, relatively new to coding so getting a bit lost trying to get this working.

    For those that don’t know, Monzo is a new UK Bank that allows API access to view your balance and recent spending amounts. Following others instructions (!), I have managed to get access to it via my Amazon Echo device. You can see a demo of this by the original author of that bit of code here, it’s pretty impressive.

    I would like to be able to access my Monzo balance on my Magic Mirror. I have seen this done on another version of MagicMirror, named Smartish-Mirror which includes a module for Monzo.

    I couldn’t get that particular installation working and know that the modules there are setup differently to the ones in MagicMirror. It does look like the author has done a great job at creating it all however.

    I have tried to build my own MagicMirror module by looking at the code from the Smartish-Mirror but I am getting myself lost and a tad frustrated!

    It’s likely an easy task for someone so I thought I would ask ands if anyone can help create the module?

    Thanks in advance,
    Jon. :)

    posted in Requests
    J
    jon11a
    May 30, 2017, 2:35 PM
  • RE: MMM-MyCommute

    @j.e.f.f
    Managed to do it and pretty pleased with myself :)

    Here’s what it looks like:

    0_1496151228319_commute.png

    I had to edit the css file to move the destination-label slightly as you mentioned:

    margin-right: 70px;
    

    I edited your formatTime function to format the time in hours and minutes or just minutes if it’s less than an hour in total.
    Below is the code for that function with my bits added, I am sure it could be better but I think I did ok!

    formatTime: function(time, timeInTraffic) {
    
        var timeEl = document.createElement("span");
        timeEl.classList.add("travel-time");
        if (timeInTraffic != null) {
          var minutes = Math.floor(Number(timeInTraffic) /60);
          var h = Math.floor(minutes /60);
          var m = Math.floor(minutes %60);
          if (h == 0) {
            timeEl.innerHTML = m + " min";
          } else {
            timeEl.innerHTML = h + "h " + m + " min";
          }
          var variance = timeInTraffic / time;
          if (this.config.colorCodeTravelTime) {
            if (variance > this.config.poorTimeThreshold) {
              timeEl.classList.add("status-poor");
            } else if (variance > this.config.moderateTimeThreshold) {
              timeEl.classList.add("status-moderate");
            } else {
              timeEl.classList.add("status-good");
            }
          }
        } else {
          var minutes = Math.floor(Number(time) /60);
          var h = Math.floor(minutes /60);
          var m = Math.floor(minutes %60);
          if (h == 0) {
            timeEl.innerHTML = m + " min";
          } else {
            timeEl.innerHTML = h + "h " + m + " min";
          }
          timeEl.classList.add("status-good");
        }
    

    Thanks for your help Jeff, learned some more programming skills too so I’m happy! :)

    posted in Transport
    J
    jon11a
    May 30, 2017, 1:39 PM
  • RE: MMM-MyCommute

    @j.e.f.f Thanks for your quick response Jeff. I thought that might be the reason behind your decision to just use mins. It does make sense to me.

    I think I will have a go at changing mine, will be a good little challenge for me as I’m learning more and more programming skills!

    Thanks again and I look forward to see what you come up with next ;)

    posted in Transport
    J
    jon11a
    May 30, 2017, 11:35 AM
  • RE: MMM-MyCommute

    Hi @j.e.f.f
    Just wanted to say, thanks so much for spending your time building this module! I have just finished my MagicMirror build and this module is by far the best and most used. I love how much I’m able to customise it to thanks to your hard work.

    Now, I wondered if it was easy to add the following… My commute is always over an hour, would it be possible to format the commute time to show 1h 30 min rather than 90 min for example? It would still show just ‘min’ if under an hour (20 min for example).

    If it’s not all that easy and you’d rather not alter the code, then that’s fine, I may have a bash at editing the code on my Pi myself.

    Thanks again!

    posted in Transport
    J
    jon11a
    May 30, 2017, 11:01 AM
Enjoying MagicMirror? Please consider a donation!
MagicMirror created by Michael Teeuw.
Forum managed by Sam, technical setup by Karsten.
This forum is using NodeBB as its core | Contributors
Contact | Privacy Policy