diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f2ad6f3..1dcbd667 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ _This release is scheduled to be released on 2021-04-01._ - Code cleanup for FEELS like and added {DEGREE} placeholder for FEELSLIKE for each language - Converted newsfeed module to use templates. - Update documentation and help screen about invalid config files. +- Moving weather provider specific code and configuration into each provider and making hourly part of the interface. ### Removed diff --git a/modules/default/weather/providers/README.md b/modules/default/weather/providers/README.md index 02cef8dd..f6e5d732 100755 --- a/modules/default/weather/providers/README.md +++ b/modules/default/weather/providers/README.md @@ -29,16 +29,23 @@ WeatherProvider.register("yourprovider", { #### `fetchCurrentWeather()` -This method is called when the weather module tries to fetch the current weather of your provider. The implementation of this method is required. +This method is called when the weather module tries to fetch the current weather of your provider. The implementation of this method is required for current weather support. The implementation can make use of the already implemented function `this.fetchData(url, method, data);`, which is returning a promise. After the response is processed, the current weather information (as a [WeatherObject](#weatherobject)) needs to be set with `this.setCurrentWeather(currentWeather);`. It will then automatically refresh the module DOM with the new data. #### `fetchWeatherForecast()` -This method is called when the weather module tries to fetch the weather of your provider. The implementation of this method is required. +This method is called when the weather module tries to fetch the weather of your provider. The implementation of this method is required for forecast support. The implementation can make use of the already implemented function `this.fetchData(url, method, data);`, which is returning a promise. -After the response is processed, the weather forecast information (as an array of [WeatherObject](#weatherobject)s) needs to be set with `this.setCurrentWeather(forecast);`. +After the response is processed, the weather forecast information (as an array of [WeatherObject](#weatherobject)s) needs to be set with `this.setWeatherForecast(forecast);`. +It will then automatically refresh the module DOM with the new data. + +#### `fetchWeatherHourly()` + +This method is called when the weather module tries to fetch the weather of your provider. The implementation of this method is required for hourly support. +The implementation can make use of the already implemented function `this.fetchData(url, method, data);`, which is returning a promise. +After the response is processed, the hourly weather forecast information (as an array of [WeatherObject](#weatherobject)s) needs to be set with `this.setWeatherHourly(forecast);`. It will then automatically refresh the module DOM with the new data. ### Weather Provider instance methods @@ -63,6 +70,10 @@ This returns a WeatherDay object for the current weather. This returns an array of WeatherDay objects for the weather forecast. +#### `weatherHourly()` + +This returns an array of WeatherDay objects for the hourly weather forecast. + #### `fetchedLocation()` This returns the name of the fetched location or an empty string. @@ -75,6 +86,10 @@ Set the currentWeather and notify the delegate that new information is available Set the weatherForecastArray and notify the delegate that new information is available. +#### `setWeatherHourly(weatherHourlyArray)` + +Set the weatherHourlyArray and notify the delegate that new information is available. + #### `setFetchedLocation(name)` Set the fetched location name. diff --git a/modules/default/weather/weatherprovider.js b/modules/default/weather/weatherprovider.js index 29e0aee5..87667fd9 100644 --- a/modules/default/weather/weatherprovider.js +++ b/modules/default/weather/weatherprovider.js @@ -97,7 +97,7 @@ var WeatherProvider = Class.extend({ }, // Set the weatherHourlyArray and notify the delegate that new information is available. - setWeatherHourlyData: function (weatherHourlyArray) { + setWeatherHourly: function (weatherHourlyArray) { this.weatherHourlyArray = weatherHourlyArray; },