Merge pull request #883 from jasonyork/develop

Update currentweather to support indoor temperature
This commit is contained in:
Michael Teeuw 2017-05-01 14:26:05 +02:00 committed by GitHub
commit 73a47b2853
4 changed files with 21 additions and 1 deletions

View File

@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Add test default modules present modules/default/defaultmodules.js.
- Add unit test calendar_modules function capFirst.
- Add test for check if exits the directories present in defaults modules.
- Add ability for `currentweather` module to display indoor temperature via INDOOR_TEMPERATURE notification
### Updated
- Added missing keys to Polish translation.

View File

@ -41,6 +41,7 @@ The following properties can be configured:
| `showPeriodUpper` | Show the period (AM/PM) with 12 hour format as uppercase <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `showWindDirection` | Show the wind direction next to the wind speed. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `showHumidity` | Show the current humidity <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `showIndoorTemperature` | If you have another module that emits the INDOOR_TEMPERATURE notification, the indoor temperature will be displayed <br> **Default value:** `false`
| `onlyTemp` | Show only current Temperature and weather icon. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `useBeaufort` | Pick between using the Beaufort scale for wind speed or using the default units. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `lang` | The language of the days. <br><br> **Possible values:** `en`, `nl`, `ru`, etc ... <br> **Default value:** uses value of _config.language_

View File

@ -1,4 +1,5 @@
.currentweather .weathericon {
.currentweather .weathericon,
.currentweather .fa-home {
font-size: 75%;
line-height: 65px;
display: inline-block;

View File

@ -25,6 +25,7 @@ Module.register("currentweather",{
lang: config.language,
showHumidity: false,
degreeLabel: false,
showIndoorTemperature: false,
initialLoadDelay: 0, // 0 seconds delay
retryDelay: 2500,
@ -97,6 +98,7 @@ Module.register("currentweather",{
this.sunriseSunsetTime = null;
this.sunriseSunsetIcon = null;
this.temperature = null;
this.indoorTemperature = null;
this.weatherType = null;
this.loaded = false;
@ -203,6 +205,17 @@ Module.register("currentweather",{
temperature.innerHTML = " " + this.temperature + "&deg;" + degreeLabel;
large.appendChild(temperature);
if (this.config.showIndoorTemperature && this.indoorTemperature) {
var indoorIcon = document.createElement("span");
indoorIcon.className = "fa fa-home";
large.appendChild(indoorIcon);
var indoorTemperatureElem = document.createElement("span");
indoorTemperatureElem.className = "bright";
indoorTemperatureElem.innerHTML = " " + this.indoorTemperature + "&deg;" + degreeLabel;
large.appendChild(indoorTemperatureElem);
}
wrapper.appendChild(large);
return wrapper;
},
@ -239,6 +252,10 @@ Module.register("currentweather",{
}
}
}
if (notification === "INDOOR_TEMPERATURE") {
this.indoorTemperature = this.roundValue(payload);
this.updateDom(self.config.animationSpeed);
}
},
/* updateWeather(compliments)