MagicMirror² v2.12.0 is available! For more information about this release, check out this topic.

weatherforecast showing only two days.



  • Hey Guys,

    After latest update of MagicMirror (v2.12.0) module weatherforecast is showing only two day forecast no matter what I configure in “maxNumberOfDays” option.

    Can you please help me? I tried to search for any errors in logs regarding this module or api response, but I wasn`t lucky.
    Below is my config for this module and screenshot to show that it shows only two days.

    {
    module: “weatherforecast”,
    position: “top_right”,
    header: “Predpoveď počasia”,
    config: {
    lang: “sk”,
    location: “Bratislava”,
    locationID: “3060972”, //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
    appid: “6ba6364f776c4927bf2145c8582e8c3c”,
    maxNumberOfDays: “7”,
    colored: “true”,
    fade: “false”,
    fadePoint: “1”,
    showRainAmount: “true”,
    scale: “true”,
    }
    },
    alt text


  • Module Developer

    @erik-voznak have you tried

    maxNumberOfDays: 7
    

    needs to be a number instead of a string.
    fadePoint as well.
    You need to be careful with the format of the values.
    Look into the readme what format is expected.
    https://docs.magicmirror.builders/modules/weatherforecast.html#configuration-options



  • I have the same problem Tryed to change in module config to change numbers of days,tried in weatherforecast.js,always the same Anybody knows how to solve problem?



  • @lavolp3

    tried right now and no change.

    maxNumberOfDays: 7,
    colored: “true”,
    fade: “false”,
    fadePoint: 1,


  • Module Developer



  • @lavolp3
    I did update this morning and issue started after update…

    [2020-07-02 13:37:30.638] [LOG] Starting MagicMirror: v2.12.0
    [2020-07-02 13:37:30.651] [LOG] Loading config …



  • @erik-voznak said in weatherforecast showing only two days.:

    you shouldn’t have posted it but I checked your appid and is wrong or not valid {code 401}



  • Had the same issue after the update.
    The problem is, that the weatherforecast first checks the paid version of the API to get full day forecasts (https://api.openweathermap.org/data/2.5/forecast/daily?id=xxx&cnt=7&units=metric&lang=de&APPID=xxx)

    This results in a 401 for me because I’m using a free API token.

    Next the weatherforecast module falls back using the 5 day / 3 hour Forecast API by using the same cnt value (https://api.openweathermap.org/data/2.5/forecast?id=xxx&cnt=7&units=metric&lang=de&APPID=xxx). Here the value 7 for cnt returns 7 entries, that’s why there is only a two day forecast.

    I’ll try to write a fix.
    In the meantime as a quick fix you can change line 297 of weatherforecast.js from:

    params += "&cnt=" + (this.config.maxNumberOfDays < 1 || this.config.maxNumberOfDays > 17 ? 7 : this.config.maxNumberOfDays);
    

    to

    params += "&cnt=" + (this.config.maxNumberOfDays < 1 || this.config.maxNumberOfDays > 5 ? 40 : this.config.maxNumberOfDays * 8);
    

    Remeber the fallback API provides only a 5 day forecast, that’s why maxNumberOfDays is limited to 5.



  • @hango, yeah I know I shouldn`t but I am using free API so… but anyway I will change appid.

    @oemel09, Many thanks man, your fix helped and finally it is working as intended.

    alt text



  • This fix worked for me too, so thanks very much.

    Also, showRainAmount: “false” does not work - i still see mm rain forecast against each day.

    This is all a little disappointing as up until the recent upgrade, ‘weatherforecast’ was working perfectly.

    And BTW, in trying to resolve the problem with ‘weatherforecast’, before coming to this thread, I also tried the ‘weather’ module, the replacement for ‘currentweather’ and ‘weatherforecast’. I couldn’t get that to work in ‘forecast’ mode, only in ‘current’ mode. The module just displays ‘Loading…’.

    Ho-hum…


Log in to reply