• 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
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Weather Forecast: showRainAmount displays in mm even when config.units='imperial'

Scheduled Pinned Locked Moved Unsolved Troubleshooting
9 Posts 3 Posters 4.2k Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    MichMich Admin
    last edited by Jan 15, 2017, 7:34 PM

    It seems the “mm” part is hard coded:
    https://github.com/MichMich/MagicMirror/blob/master/modules/default/weatherforecast/weatherforecast.js#L153

    Does it really show the amount in mm? or does it just show the wrong unit?

    1 Reply Last reply Reply Quote 0
    • M Offline
      MichMich Admin
      last edited by Jan 15, 2017, 7:40 PM

      Hmmm… it seems OpenWeatherMap returns the data in MM no matter which what we request.
      What unit would be preferred? Inch? What notation would you recommend?

      S 1 Reply Last reply Jan 15, 2017, 7:46 PM Reply Quote 0
      • S Offline
        strawberry 3.141 Project Sponsor Module Developer @MichMich
        last edited by Jan 15, 2017, 7:46 PM

        @MichMich wikipedia tells inch for rain measurements https://en.wikipedia.org/wiki/Rain#Measurement

        if(config.units === "imperial"{
          rainCell.innerHTML = forecast.rain / 25.4 + " in";
        }
        

        probably need parseFloat() for the data if its a string

        Please create a github issue if you need help, so I can keep track

        1 Reply Last reply Reply Quote 0
        • F Offline
          fjnorb
          last edited by Jan 15, 2017, 7:55 PM

          It looks like it is returning millimeters. For instance, it says on Tuesday we’re going to get 15mm of rain, that’s about a half an inch, which is much more reasonable than the notion that we’d get 15 inches (381mm) of rain in one day. That sort of thing would be in the news feed, lol.

          1 Reply Last reply Reply Quote 0
          • M Offline
            MichMich Admin
            last edited by Jan 15, 2017, 8:16 PM

            I pushed an update to the develop branch. Please give it a try.

            1 Reply Last reply Reply Quote 1
            • F Offline
              fjnorb
              last edited by Jan 15, 2017, 9:58 PM

              Can you give me a quick idea of how to do that please? Installation was so simple I don’t know how.

              S 1 Reply Last reply Jan 15, 2017, 10:07 PM Reply Quote 0
              • S Offline
                strawberry 3.141 Project Sponsor Module Developer @fjnorb
                last edited by Jan 15, 2017, 10:07 PM

                @fjnorb

                cd ~/MagicMirror
                git fetch
                git checkout develop
                npm install
                

                Please create a github issue if you need help, so I can keep track

                1 Reply Last reply Reply Quote 0
                • F Offline
                  fjnorb
                  last edited by Jan 15, 2017, 10:10 PM

                  Looks great! Appreciate the quick fix and quick responses, wish more FOSS projects were this professional and responsive.

                  1 Reply Last reply Reply Quote 1
                  • 1 / 1
                  1 / 1
                  • First post
                    6/9
                    Last post
                  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