mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-22 21:11:17 +00:00
Add option to show hourly forecast in increments (#2998)
Adds new config option to show weather forecast for every X hour (default value is 1 which reflects the current behaviour) Also adds tests for hourly forecast Fixes #2996 Co-authored-by: veeck <michael@veeck.de>
This commit is contained in:
@@ -12,23 +12,25 @@ Module.register("weather", {
|
||||
weatherProvider: "openweathermap",
|
||||
roundTemp: false,
|
||||
type: "current", // current, forecast, daily (equivalent to forecast), hourly (only with OpenWeatherMap /onecall endpoint)
|
||||
lang: config.language,
|
||||
units: config.units,
|
||||
tempUnits: config.units,
|
||||
windUnits: config.units,
|
||||
timeFormat: config.timeFormat,
|
||||
updateInterval: 10 * 60 * 1000, // every 10 minutes
|
||||
animationSpeed: 1000,
|
||||
timeFormat: config.timeFormat,
|
||||
showFeelsLike: true,
|
||||
showHumidity: false,
|
||||
showIndoorHumidity: false,
|
||||
showIndoorTemperature: false,
|
||||
showPeriod: true,
|
||||
showPeriodUpper: false,
|
||||
showPrecipitationAmount: false,
|
||||
showSun: true,
|
||||
showWindDirection: true,
|
||||
showWindDirectionAsArrow: false,
|
||||
lang: config.language,
|
||||
showHumidity: false,
|
||||
showSun: true,
|
||||
degreeLabel: false,
|
||||
decimalSymbol: ".",
|
||||
showIndoorTemperature: false,
|
||||
showIndoorHumidity: false,
|
||||
maxNumberOfDays: 5,
|
||||
maxEntries: 5,
|
||||
ignoreToday: false,
|
||||
@@ -39,10 +41,9 @@ Module.register("weather", {
|
||||
calendarClass: "calendar",
|
||||
tableClass: "small",
|
||||
onlyTemp: false,
|
||||
showPrecipitationAmount: false,
|
||||
colored: false,
|
||||
showFeelsLike: true,
|
||||
absoluteDates: false
|
||||
absoluteDates: false,
|
||||
hourlyForecastIncrements: 1
|
||||
},
|
||||
|
||||
// Module properties.
|
||||
@@ -137,13 +138,17 @@ Module.register("weather", {
|
||||
|
||||
// Add all the data to the template.
|
||||
getTemplateData: function () {
|
||||
const forecast = this.weatherProvider.weatherForecast();
|
||||
const currentData = this.weatherProvider.currentWeather();
|
||||
const forecastData = this.weatherProvider.weatherForecast();
|
||||
|
||||
// Skip some hourly forecast entries if configured
|
||||
const hourlyData = this.weatherProvider.weatherHourly()?.filter((e, i) => (i + 1) % this.config.hourlyForecastIncrements === this.config.hourlyForecastIncrements - 1);
|
||||
|
||||
return {
|
||||
config: this.config,
|
||||
current: this.weatherProvider.currentWeather(),
|
||||
forecast: forecast,
|
||||
hourly: this.weatherProvider.weatherHourly(),
|
||||
current: currentData,
|
||||
forecast: forecastData,
|
||||
hourly: hourlyData,
|
||||
indoor: {
|
||||
humidity: this.indoorHumidity,
|
||||
temperature: this.indoorTemperature
|
||||
|
Reference in New Issue
Block a user