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.
    • F Offline
      fjnorb
      last edited by

      Hello. Brand new MM2 user, I love it. Thank you for taking the time to make it easy to install and configure. I spent weeks last year fighting with Conky to do my own thing and I had this running immediately after installation.

      I have a small issue, however, that I hope someone has solved. Being in the United States, I have units set to ‘imperial’ in my config, and both the Current Weather and Weather Forecast are using imperial units for temperature and other things. But I enabled showRainAmount, and the rain amounts are showing in millimeters.

      Is this a limitation with OpenWeatherMap, a missing conversion in the Weather Forecast module, or a mistake on my part?

      Thanks for any and all assistance.

      1 Reply Last reply Reply Quote 0
      • MichMichM Offline
        MichMich Admin
        last edited by

        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
        • MichMichM Offline
          MichMich Admin
          last edited by

          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?

          strawberry 3.141S 1 Reply Last reply Reply Quote 0
          • strawberry 3.141S Offline
            strawberry 3.141 Project Sponsor Module Developer @MichMich
            last edited by

            @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

              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
              • MichMichM Offline
                MichMich Admin
                last edited by

                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

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

                  strawberry 3.141S 1 Reply Last reply Reply Quote 0
                  • strawberry 3.141S Offline
                    strawberry 3.141 Project Sponsor Module Developer @fjnorb
                    last edited by

                    @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

                      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
                      • First post
                        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