Read the statement by Michael Teeuw here.
Weather Forecast: showRainAmount displays in mm even when config.units='imperial'
-
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.
-
It seems the “mm” part is hard coded:
https://github.com/MichMich/MagicMirror/blob/master/modules/default/weatherforecast/weatherforecast.js#L153Does it really show the amount in mm? or does it just show the wrong unit?
-
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? -
@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
-
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.
-
I pushed an update to the
develop
branch. Please give it a try. -
Can you give me a quick idea of how to do that please? Installation was so simple I don’t know how.
-
cd ~/MagicMirror git fetch git checkout develop npm install
-
Looks great! Appreciate the quick fix and quick responses, wish more FOSS projects were this professional and responsive.