diff --git a/modules/default/weather/README.md b/modules/default/weather/README.md
index d8766824..ee9ec7b8 100644
--- a/modules/default/weather/README.md
+++ b/modules/default/weather/README.md
@@ -48,7 +48,6 @@ The following properties can be configured:
| `lang` | The language of the days.
**Possible values:** `en`, `nl`, `ru`, etc ...
**Default value:** uses value of _config.language_
| `decimalSymbol` | The decimal symbol to use.
**Possible values:** `.`, `,` or any other symbol.
**Default value:** `.`
| `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`
| `appendLocationNameToHeader` | If set to `true`, the returned location name will be appended to the header of the module, if the header is enabled. This is mainly intresting when using calender based weather.
**Default value:** `true`
| `calendarClass` | The class for the calender module to base the event based weather information on.
**Default value:** `'calendar'`
@@ -63,6 +62,7 @@ The following properties can be configured:
| `showHumidity` | Show the current humidity
**Possible values:** `true` or `false`
**Default value:** `false`
| `showIndoorTemperature` | If you have another module that emits the `INDOOR_TEMPERATURE` notification, the indoor temperature will be displayed
**Default value:** `false`
| `showIndoorHumidity` | If you have another module that emits the `INDOOR_HUMIDITY` notification, the indoor humidity will be displayed
**Default value:** `false`
+| `showFeelsLike` | Shows the Feels like temperature weather.
**Possible values:**`true` or `false`
**Default value:** `true`
#### Weather forecast options
diff --git a/modules/default/weather/current.njk b/modules/default/weather/current.njk
index a788bcc2..aed51ac6 100644
--- a/modules/default/weather/current.njk
+++ b/modules/default/weather/current.njk
@@ -51,6 +51,13 @@
{% endif %}
+ {% if config.showFeelsLike and not config.onlyTemp %}
+
+
+ {{ "FEELS" | translate }} {{ current.feelsLike() | roundValue | unit("temperature") }}
+
+
+ {% endif %}
{% else %}
{{"LOADING" | translate}}
diff --git a/modules/default/weather/providers/openweathermap.js b/modules/default/weather/providers/openweathermap.js
index 8fd1e3be..caa88b21 100644
--- a/modules/default/weather/providers/openweathermap.js
+++ b/modules/default/weather/providers/openweathermap.js
@@ -17,7 +17,7 @@ WeatherProvider.register("openweathermap", {
providerName: "OpenWeatherMap",
// Overwrite the fetchCurrentWeather method.
- fetchCurrentWeather: function() {
+ fetchCurrentWeather() {
this.fetchData(this.getUrl())
.then(data => {
if (!data || !data.main || typeof data.main.temp === "undefined") {
@@ -28,7 +28,7 @@ WeatherProvider.register("openweathermap", {
this.setFetchedLocation(`${data.name}, ${data.sys.country}`);
- var currentWeather = this.generateWeatherObjectFromCurrentWeather(data);
+ const currentWeather = this.generateWeatherObjectFromCurrentWeather(data);
this.setCurrentWeather(currentWeather);
})
.catch(function(request) {
@@ -37,7 +37,7 @@ WeatherProvider.register("openweathermap", {
},
// Overwrite the fetchCurrentWeather method.
- fetchWeatherForecast: function() {
+ fetchWeatherForecast() {
this.fetchData(this.getUrl())
.then(data => {
if (!data || !data.list || !data.list.length) {
@@ -48,7 +48,7 @@ WeatherProvider.register("openweathermap", {
this.setFetchedLocation(`${data.city.name}, ${data.city.country}`);
- var forecast = this.generateWeatherObjectsFromForecast(data.list);
+ const forecast = this.generateWeatherObjectsFromForecast(data.list);
this.setWeatherForecast(forecast);
})
.catch(function(request) {
@@ -62,15 +62,15 @@ WeatherProvider.register("openweathermap", {
/*
* Gets the complete url for the request
*/
- getUrl: function() {
+ getUrl() {
return this.config.apiBase + this.config.apiVersion + this.config.weatherEndpoint + this.getParams();
},
/*
* Generate a WeatherObject based on currentWeatherInformation
*/
- generateWeatherObjectFromCurrentWeather: function(currentWeatherData) {
- var currentWeather = new WeatherObject();
+ generateWeatherObjectFromCurrentWeather(currentWeatherData) {
+ const currentWeather = new WeatherObject(this.config.units);
currentWeather.humidity = currentWeatherData.main.humidity;
currentWeather.temperature = currentWeatherData.main.temp;
@@ -86,11 +86,11 @@ WeatherProvider.register("openweathermap", {
/*
* Generate WeatherObjects based on forecast information
*/
- generateWeatherObjectsFromForecast: function(forecasts) {
- var days = [];
+ generateWeatherObjectsFromForecast(forecasts) {
+ const days = [];
- for (var forecast of forecasts) {
- var weather = new WeatherObject();
+ for (const forecast of forecasts) {
+ const weather = new WeatherObject(this.config.units);
weather.date = moment(forecast.dt, "X");
weather.minTemperature = forecast.temp.min;
@@ -107,8 +107,8 @@ WeatherProvider.register("openweathermap", {
/*
* Convert the OpenWeatherMap icons to a more usable name.
*/
- convertWeatherType: function(weatherType) {
- var weatherTypes = {
+ convertWeatherType(weatherType) {
+ const weatherTypes = {
"01d": "day-sunny",
"02d": "day-cloudy",
"03d": "cloudy",
@@ -137,8 +137,8 @@ WeatherProvider.register("openweathermap", {
*
* return String - URL params.
*/
- getParams: function() {
- var params = "?";
+ getParams() {
+ let params = "?";
if(this.config.locationID) {
params += "id=" + this.config.locationID;
} else if(this.config.location) {
diff --git a/modules/default/weather/weather.js b/modules/default/weather/weather.js
index 03e15bda..d2a64749 100644
--- a/modules/default/weather/weather.js
+++ b/modules/default/weather/weather.js
@@ -46,7 +46,8 @@ Module.register("weather",{
onlyTemp: false,
showRainAmount: true,
- colored: false
+ colored: false,
+ showFeelsLike: true
},
// Module properties.
diff --git a/modules/default/weather/weatherobject.js b/modules/default/weather/weatherobject.js
index a30a415c..599708c3 100644
--- a/modules/default/weather/weatherobject.js
+++ b/modules/default/weather/weatherobject.js
@@ -77,4 +77,23 @@ class WeatherObject {
nextSunAction() {
return moment().isBetween(this.sunrise, this.sunset) ? "sunset" : "sunrise";
}
+
+ feelsLike() {
+ const windInMph = this.units === "imperial" ? this.windSpeed : this.windSpeed * 2.23694;
+ const tempInF = this.units === "imperial" ? this.temperature : this.temperature * 9 / 5 + 32;
+ let feelsLike = tempInF;
+
+ if (windInMph > 3 && tempInF < 50) {
+ feelsLike = Math.round(35.74 + 0.6215 * tempInF - 35.75 * Math.pow(windInMph, 0.16) + 0.4275 * tempInF * Math.pow(windInMph, 0.16));
+ } else if (tempInF > 80 && this.humidity > 40) {
+ feelsLike = -42.379 + 2.04901523 * tempInF + 10.14333127 * this.humidity
+ - 0.22475541 * tempInF * this.humidity - 6.83783 * Math.pow(10, -3) * tempInF * tempInF
+ - 5.481717 * Math.pow(10, -2) * this.humidity * this.humidity
+ + 1.22874 * Math.pow(10, -3) * tempInF * tempInF * this.humidity
+ + 8.5282 * Math.pow(10, -4) * tempInF * this.humidity * this.humidity
+ - 1.99 * Math.pow(10, -6) * tempInF * tempInF * this.humidity * this.humidity;
+ }
+
+ return this.units === "imperial" ? feelsLike : (feelsLike - 32) * 5 / 9;
+ }
}