MMM-DarkSkyForecast icon indicating copy to clipboard operation
MMM-DarkSkyForecast copied to clipboard

Can You Add Humidity?

Open revere521 opened this issue 6 years ago • 2 comments

Hello - this is great! I've been looking for a module that incorporated a daily forecast with an hourly ever since the Weather Underground API went down - this is Awesome and looks great.

I'd like to ask for a feature when you are able - can you add humidity? At least to the current conditions at the top?

revere521 avatar Jan 13 '19 14:01 revere521

I'm using this module and it's great. I have the need to see the weather conditions for several locations and I tried to use MMM-Carousel to be able to scroll the same module with different locations, but no luck. I was wondering if I can do it directly in this module, like putting in the config section several locations and make the module display them one by one in the same position with a programmable interval.

Thank you in advanced for your help.

RafaelCota avatar Jan 31 '19 18:01 RafaelCota

So I am just starting to learn JS but I figured out how to add in SR/SS times (and pretty much any other). Though it does kinda bastardized the code until I learn more and figure out all the styling and adding in new divs and such.

Basically I edited the DarkSkyForecast.js file and added what I wanted from here: https://darksky.net/dev/docs#forecast-request to the summary in this area:

processWeatherData: function() {

    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") + " | " + 
        "Humidity: " + this.weatherData.currently.humidity * 100 + "%" + " | Dew Point: " + Math.round(this.weatherData.currently.dewPoint) + "°";
    }

This gave me the data I wanted, appended to the summary data. So it doesn't look the prettiest, but works until I learn more. Hopefully this helps you.

2020-02-07 09_52_42-Magic Mirror

esmoyer avatar Feb 07 '20 16:02 esmoyer