Coder Social home page Coder Social logo

mmm-forecast-io's Introduction

MMM-Forecast-IO

This an extension for MagicMirror that adds localized weather using the Dark Sky API (originally Forecast.io) -- the same service that powers the Dark Sky App.

This module makes use of the geolocation API to determine the location of the mirror. This can be turned off by setting latitude and longitude in the module's config (see Configuration options below).

Unless running headless in a browser, Geolocation requires setting the GOOGLE_API_KEY environment variable.

screenshot

Using the module

To use this module, add it to the modules array in the config/config.js file:

modules: [
  {
    module: 'MMM-forecast-io',
    position: 'top_right',  // This can be any of the regions.
    config: {
      // See 'Configuration options' for more information.
      apiKey: 'abcde12345abcde12345abcde12345ab', // Dark Sky API key.
      // Only required if geolocation doesn't work:
      latitude:   16.77532,
      longitude: -3.008265
    }
  }
]

Configuration options

Option Description
apiKey The Dark Sky API key, which can be obtained by creating an Dark Sky API account.

This value is REQUIRED
units What units to use. Specified by config.js

Possible values: config.units = Specified by config.js, default = Kelvin, metric = Celsius, imperial =Fahrenheit
Default value: config.units
language The language of the weather text.

Possible values: en, nl, ru, etc ...
Default value: uses value of config.language
updateInterval How often does the content needs to be fetched? (Milliseconds)

Forecast.io enforces a 1,000/day request limit, so if you run your mirror constantly, anything below 90,000 (every 1.5 minutes) may require payment information or be blocked.

Possible values: 1000 - 86400000
Default value: 300000 (5 minutes)
animationSpeed Speed of the update animation. (Milliseconds)

Possible values:0 - 5000
Default value: 2000 (2 seconds)
initialLoadDelay The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds)

Possible values: 1000 - 5000
Default value: 0
retryDelay The delay before retrying after a request failure. (Milliseconds)

Possible values: 1000 - 60000
Default value: 2500
latitude The latitude location in decimal. Set this (and longitude) as the location for the forecast. If this is not set, the module will attempt to approximate using browser geolocation.

Example value: 16.77532
Default value: null
longitude The longitude location in decimal. Set this (and latitude) as the location for the forecast. If this is not set, the module will attempt to approximate using browser geolocation.

Example value: -3.008265
Default value: null
showTextSummary Toggles display of text summary.

Default value: true
showCurrentWeather Toggles display of current weather.

Default value: true
showIndoorTemperature If you have another module that emits the INDOOR_TEMPERATURE notification, the indoor temperature will be displayed.

Default value: false
showWind Toggles display of wind conditions

Default value: true
apiBase The Dark Sky API base URL.

Default value: 'https://api.darksky.net/forecast'
showForecast Toggles display of the seven-day weather forecast.

Default value: true
showFeelsLike Toggles display of the local "feels like" temperature. Feels like is the ambient air temperature, adjusted for relative humidity and wind speed to determine how weather conditions feel to bare skin.

Default value: false
fadeForecast Toggles fading of last 2 forecast rows.

Default value: false
maxDaysForecast Limit how many days of weather forecast. Useful values 1-7

Default value: 7
showSunriseSunset Toggles display of sunrise and sunset times

Default value: true
enablePrecipitationGraph Toggles display of the precipitation graph.

Default value: true
alwaysShowPrecipitationGraph Force the precipition graph to always show, and not just when it's raining.

Default value: false
precipitationFillColor Choose the color of the precipitation graph. Will accept hex value or color names of Javascript-friendly colors. See this page for a list of colors. "dodgerblue" appears to best mimic the Dark Sky app.

Default value: white
precipitationGraphWidth Width of the precipitation graph element in pixels. Scales height to match.

Default value: 400
forecastTableFontSize Sets CSS font style for forecast table. Possible values: 'xsmall', 'small', 'medium', 'large', 'xlarge'

Default value: 'medium'
precipitationProbabilityThreshold Probability threshold at which rain is rendered onto the precipitation graph.
See the Darksky.net API documentation for more details.

Default value: 0.1
showDailyPrecipitationChance Toggles display of the precipitation probability for each day.

Default value: true
iconTable The conversion table to convert the weather conditions to weather-icons.

Default value:
iconTable: {
      'clear-day':           'wi-day-sunny',
      'clear-night':         'wi-night-clear',
      'rain':                'wi-rain',
      'snow':                'wi-snow',
      'sleet':               'wi-rain-mix',
      'wind':                'wi-cloudy-gusts',
      'fog':                 'wi-fog',
      'cloudy':              'wi-cloudy',
      'partly-cloudy-day':   'wi-day-cloudy',
      'partly-cloudy-night': 'wi-night-cloudy',
      'hail':                'wi-hail',
      'thunderstorm':        'wi-thunderstorm',
      'tornado':             'wi-tornado'
    }

mmm-forecast-io's People

Contributors

arx237 avatar dmcinnes avatar idoodler avatar mattdarragh avatar morozgrafix avatar pyrosmiley avatar randomstring avatar sickboy78 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mmm-forecast-io's Issues

Shows a previous day

Hi, at the day of writing this (friday) the module is showing me a thursday.
While the temperature it's showing is from the friday.
And the clock module (default module) is correctly showing friday and the right day. month, year and timezone.

Does anyone know how to fix this?

How to install

Please excuse my lack of experience, but how do I install this?
I've setup the config, but now just getting a black screen (I presume because I'm calling a module that's not installed?).

Thanks, David.

size

Is there a way to make the forecast and precipitation graph smaller together?

API alternative?

Now that Apple bought DarkSky...
The API will continue to function through the end of 2021.

Precipitation chart axis wrong?

fullsizerender
img_5962

Huge thanks for creating this module - very impressive!

I've managed to successfully install the module and add it to config.js, however, the precipitation axis isn't rendering correctly when compared to my iPhone app.

The iPhone app is showing light rain in 20 mins (about 1/3rd of the height of the light section of the axis) which slowly raising to the start of the medium section of the axis by 60 mins.

The module shows the same start and end times but the chart basically goes from 0 to 100% instantly. This suggests to me that the y-axis is set too low. While I was able to install the module my programming skills aren't technical enough to make sense of the underlying code.

Also, one final query - is there a way to reduce the size of the text and make it closer to the size of the default weather module text?

Thanks again

P.S. Just updated comment with screenshots!

Graph color cannot be configured

Currently the graph color is hard coded to white, but it would be useful to be able to configure this, since it's impossible to modify using custom CSS.

Feature Request: Indoor temperature

First of all, thanks for that great module!

I am owning a Smart Home and decided to develop a module that let my MagicMirror communicate with my house. I don't want to waste to much space and don't want to display too much modules.

The default currentweather module supports the INDOOR_TEMPERATURE notification to display the current indoor temperature.

I would love to see this supported to maintain a clean and open design.

Thanks

Precipitation Graph does not display / loads endlessly

Hi,
thanks a lot for this module. I really like it since I use the mobile app as well daily.
On rainy days the module does not show any precipitation graph. If I force the graph to be displayed with your new switch it loads endlessly.
How do you suggest to debug the issue?
Thanks
Wgb

This is my code in the config file.

                {
                        module: "MMM-forecast-io",
                        classes: "small",
                        position: "bottom_left",
                        header: "Hamburg, DE",
                        config: {
                                apiKey: "??????????????????????????????", // removed
                                alwaysShowPrecipitationGraph: true,
                                latitude: 54.559676,
                                longitude: 9.168873
                        }
                },

Feature request:

Hi there, great work! I use DarkSky on my Android so it's awesome that I can keep using it for my MagicMirror.

One thing I'd like to request (and I would try my hand at coding if I was any good at JS): On the Android app, you will see a forecast for the next 24 hours (every 2 hours) plus the daily forecast for the coming week (please see screenshot below). I like this feature since I can figure out what I need to wear in the morning and how much clothing I might shed in the afternoon ;)

Since we're gathering the hourly/minutely data already, is there a way to add that under renderWeatherForecast ? Thanks!

screenshot_2016-12-05-22-01-47

git clone .... nmp install needed?

Hi,

I am interested to use your forecast module, which seems very nice.

As I did not find this information, is a "git clone ..." and "npm install" command needed to install the files ? before configuring the config file?

Thank in advance and thank you for your interest and your job!

Current icon is always pulled from hourly forecast and not from current

It seems that following logic is always using hourly.icon even if minutely is available.

var icon = minutely ? minutely.icon : hourly.icon;
var iconClass = this.config.iconTable[hourly.icon];

Source: https://github.com/dmcinnes/MMM-forecast-io/blob/master/MMM-forecast-io.js#L150

Also it seems since this icon is displayed for current conditions it would be better to use currentWeather.icon and then fall back on hourly.icon.

I have made that change on one of my branches and happy to submit a PR if you feel like this is a good change.

Thanks.

No Graph

Hi, Great to see a DarkSky fed module!!

I'm trying to get the graph to appear. My config as follows:

        {
            module: 'MMM-forecast-io',
            position: 'top_right',  // This can be any of the regions.
            config: {
                apiKey: 'fe479b4009d64ad9d5eea688a8540107', // Dark Sky API key.
                latitude: 51.580609,
                longitude: -0.013175,
                showForcast: true,
                showPrecipitationGraph: true,
            }
        },

Everything else is working, just not the graph.

Thanks, David.

Swap placement of temperature and forecast description

Hi, I am trying to reposition some of the elements of the module. Currently, it reads (including real data):

"[Icon] 53º
Mostly cloudy for the hour"

I'd like to rearrange to read:

"Mostly cloudy for the hour
[Icon] 53º"

How can I do this? Thanks!

Typo in README

There is a typo in the README at line 112 <td><code>showForcast</code></td> should read <td><code>showForecast</code></td>

module breaks if no minutely data

The module currently breaks for users that have no access to minutely data.

The problem is the following part (line 256):
isAnyPrecipitation: function (minutely) { if (!minutely) { return false; } var data = this.weatherData.minutely.data; var threshold = this.config.precipitationProbabilityThreshold; for (i = 0; i < data.length; i++) { if (data[i].precipProbability > threshold) { return true; } } return false; },
There needs to be an hourly distinction for users that don't have minutely data.

Scale Entire Module?

when using this module it is really big on my screen is there a way to scale the entire module? i saw i can change the graph and table but haven't been able to make the whole thing smaller?

showSunriseSunset variable.

README.md shows "showSunsetSunrise", incorrect.
As per MMM-forecast-io.js shows "showSunriseSunset".
Small typo :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.