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

MMM-DarkSkyForecast



  • Thank you in advance, has anyone configured the sunrise and sunset in the dark sky
    forecast module? I have seen the question asked but cannot find an answer.



  • I was able to do it, though, I am still learning a lot and how to format it into it’s own area. Right now it just hitches onto the Summary section but it at least shows it. Hopefully it helps.

    https://github.com/jclarke0000/MMM-DarkSkyForecast/issues/13



  • @smoysauce
    Thanks but no joy, I added the following to the MMM.darkskyforecast.js

    var summary;
    if (this.config.concise) {
    summary = this.weatherData.hourly ? this.weatherData.hourly.summary : this.weatherData.currently.summary;
    } else {
    summary = (this.weatherData.minutely ? this.weatherData.minutely.summary : this.weatherData.currently.summary + “.”) + " " +
    (this.weatherData.hourly ? this.weatherData.hourly.summary + " " : “”) +
    (this.weatherData.daily ? this.weatherData.daily.summary : “”) + " | " + "Sunrise: " + moment(new Date(this.weatherData.daily.data[0].sunriseTime * 1000)).format(“LT”) +
    " | Sunset: " + moment(new Date(this.weatherData.daily.data[0].sunsetTime * 1000)).format(“LT”);
    }

    (leaving out the humidity and dew point in the example) now I get the black screen!

    Thank you in advance for any assistance, as you can tell I am a noob.



  • Did you just add it or did you replace/append the exisiting? If you just added it that won’t work. YOu need to find that section and either replace it or you can append what you want to the end. You also could have removed too much probably missing a comma or semicolon. If you don’t want humidity and dew point you would to the var summary section and use:

        var summary;
        if (this.config.concise) {
          summary = this.weatherData.hourly ? this.weatherData.hourly.summary : this.weatherData.currently.summary;
        } else {
          summary = (this.weatherData.minutely ? this.weatherData.minutely.summary : this.weatherData.currently.summary + ".") + " " +  (this.weatherData.hourly ? this.weatherData.hourly.summary + " " : "") + (this.weatherData.daily ? this.weatherData.daily.summary : "") + " | " + "Sunrise: " + moment(new Date(this.weatherData.daily.data[0].sunriseTime * 1000)).format("LT") +
            " | Sunset: " + moment(new Date(this.weatherData.daily.data[0].sunsetTime * 1000)).format("LT") ;
        }
    

    I would say your best bet is to just go to that section and add + " | " + "Sunrise: " + moment(new Date(this.weatherData.daily.data[0].sunriseTime * 1000)).format("LT") + " | Sunset: " + moment(new Date(this.weatherData.daily.data[0].sunsetTime * 1000)).format("LT") just before the ; at the end.



  • @smoysauce
    Thank you very much it is now working, it had nothing to do with what you had written, I had an error in my config.js, I had inserted showSunriseSunset = true; and that obviously was completely wrong. I removed that line and bingo all is well. Thank you again.



  • Glad to hear it!


Log in to reply