jclarke0000 / MMM-OpenWeatherForecast

Magic Mirror weather module using OpenWeather API
44 stars 26 forks source link

Accumulation #25

Open ykuzmycz opened 1 year ago

ykuzmycz commented 1 year ago

I'm curious if I'm missing something or config is incorrect. Daily rain should show precipitation and percentage. Oddly I'm only seeing % and not number of mm of rain.

fItem.precipitation = this.formatPrecipitation(fData.pop, fData.rain ? fData.rain["1h"] : null, fData.snow ? fData.snow["1h"] : null);

formatPrecipitation: function(percentChance, rainAccumulation, snowAccumulation) {

var accumulation = null;

//accumulation
if (!this.config.concise && (rainAccumulation || snowAccumulation) ) {
  if (rainAccumulation){ //rain
    accumulation = (Math.round(rainAccumulation * 10) / 10) + " " + this.getUnit("accumulationRain");
  } else if (snowAccumulation) { //snow
    accumulation = Math.round(snowAccumulation) + " " + this.getUnit("accumulationSnow");
  } 
}

return {
  pop: percentChance ? Math.round(percentChance * 100) + "%" : "0%",
  accumulation: accumulation
};

I'm seeing in the json returned: "weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"pop":0.9,"rain":{"1h":0.1}},{"dt":1675983600,

Means that I should see 90% chance of rain with 1mm of rain. Oddly nothing shows up for the amount of rain.