Update currentweather to support indoor temperature

This commit is contained in:
Jason York 2017-04-30 17:51:10 -05:00
parent 88a01d39ee
commit 0036ec2214
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 test default modules present modules/default/defaultmodules.js.
- Add unit test calendar_modules function capFirst. - Add unit test calendar_modules function capFirst.
- Add test for check if exits the directories present in defaults modules. - 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 ### Updated
- Added missing keys to Polish translation. - 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` | `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` | `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` | `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` | `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` | `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_ | `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%; font-size: 75%;
line-height: 65px; line-height: 65px;
display: inline-block; display: inline-block;

View File

@ -25,6 +25,7 @@ Module.register("currentweather",{
lang: config.language, lang: config.language,
showHumidity: false, showHumidity: false,
degreeLabel: false, degreeLabel: false,
showIndoorTemperature: false,
initialLoadDelay: 0, // 0 seconds delay initialLoadDelay: 0, // 0 seconds delay
retryDelay: 2500, retryDelay: 2500,
@ -97,6 +98,7 @@ Module.register("currentweather",{
this.sunriseSunsetTime = null; this.sunriseSunsetTime = null;
this.sunriseSunsetIcon = null; this.sunriseSunsetIcon = null;
this.temperature = null; this.temperature = null;
this.indoorTemperature = null;
this.weatherType = null; this.weatherType = null;
this.loaded = false; this.loaded = false;
@ -203,6 +205,17 @@ Module.register("currentweather",{
temperature.innerHTML = " " + this.temperature + "&deg;" + degreeLabel; temperature.innerHTML = " " + this.temperature + "&deg;" + degreeLabel;
large.appendChild(temperature); 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); wrapper.appendChild(large);
return wrapper; 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) /* updateWeather(compliments)