mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 04:02:12 +00:00
Humidity data to the current weather module
This commit is contained in:
parent
cf465a1184
commit
a7db8cf7cd
@ -106,6 +106,13 @@ The following properties can be configured:
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td><code>showHumidity</code></td>
|
||||||
|
<td>Show the current humidity<br>
|
||||||
|
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
|
||||||
|
<br><b>Default value:</b> <code>false</code>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<td><code>useBeaufort</code></td>
|
<td><code>useBeaufort</code></td>
|
||||||
<td>Pick between using the Beaufort scale for wind speed or using the default units.<br>
|
<td>Pick between using the Beaufort scale for wind speed or using the default units.<br>
|
||||||
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
|
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
|
||||||
|
@ -6,3 +6,7 @@
|
|||||||
-webkit-transform: translate(0, -3px); /* Safari */
|
-webkit-transform: translate(0, -3px); /* Safari */
|
||||||
transform: translate(0, -3px);
|
transform: translate(0, -3px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.currentweather .humidity-padding {
|
||||||
|
padding-bottom: 6px;
|
||||||
|
}
|
||||||
|
@ -23,6 +23,7 @@ Module.register("currentweather",{
|
|||||||
showWindDirection: true,
|
showWindDirection: true,
|
||||||
useBeaufort: true,
|
useBeaufort: true,
|
||||||
lang: config.language,
|
lang: config.language,
|
||||||
|
showHumidity: false,
|
||||||
|
|
||||||
initialLoadDelay: 0, // 0 seconds delay
|
initialLoadDelay: 0, // 0 seconds delay
|
||||||
retryDelay: 2500,
|
retryDelay: 2500,
|
||||||
@ -142,6 +143,21 @@ Module.register("currentweather",{
|
|||||||
sunriseSunsetTime.innerHTML = " " + this.sunriseSunsetTime;
|
sunriseSunsetTime.innerHTML = " " + this.sunriseSunsetTime;
|
||||||
small.appendChild(sunriseSunsetTime);
|
small.appendChild(sunriseSunsetTime);
|
||||||
|
|
||||||
|
wrapper.appendChild(small);
|
||||||
|
|
||||||
|
if (this.config.showHumidity) {
|
||||||
|
var middle = document.createElement("div");
|
||||||
|
middle.className = "normal small humidity-padding";
|
||||||
|
|
||||||
|
var humidity = document.createElement("span");
|
||||||
|
humidity.innerHTML = "Humidity: " + this.humidity + "%"; // TODO: Localization
|
||||||
|
var br = document.createElement("br");
|
||||||
|
|
||||||
|
middle.appendChild(humidity);
|
||||||
|
middle.appendChild(br);
|
||||||
|
wrapper.appendChild(middle);
|
||||||
|
}
|
||||||
|
|
||||||
var large = document.createElement("div");
|
var large = document.createElement("div");
|
||||||
large.className = "large light";
|
large.className = "large light";
|
||||||
|
|
||||||
@ -154,8 +170,8 @@ Module.register("currentweather",{
|
|||||||
temperature.innerHTML = " " + this.temperature + "°";
|
temperature.innerHTML = " " + this.temperature + "°";
|
||||||
large.appendChild(temperature);
|
large.appendChild(temperature);
|
||||||
|
|
||||||
wrapper.appendChild(small);
|
|
||||||
wrapper.appendChild(large);
|
wrapper.appendChild(large);
|
||||||
|
|
||||||
return wrapper;
|
return wrapper;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -224,6 +240,7 @@ Module.register("currentweather",{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.humidity = parseFloat(data.main.humidity);
|
||||||
this.temperature = this.roundValue(data.main.temp);
|
this.temperature = this.roundValue(data.main.temp);
|
||||||
|
|
||||||
if (this.config.useBeaufort){
|
if (this.config.useBeaufort){
|
||||||
@ -315,39 +332,39 @@ Module.register("currentweather",{
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
deg2Cardinal: function(deg) {
|
deg2Cardinal: function(deg) {
|
||||||
if (deg>11.25 && deg<=33.75){
|
if (deg>11.25 && deg<=33.75){
|
||||||
return "NNE";
|
return "NNE";
|
||||||
} else if (deg > 33.75 && deg <= 56.25) {
|
} else if (deg > 33.75 && deg <= 56.25) {
|
||||||
return "NE";
|
return "NE";
|
||||||
} else if (deg > 56.25 && deg <= 78.75) {
|
} else if (deg > 56.25 && deg <= 78.75) {
|
||||||
return "ENE";
|
return "ENE";
|
||||||
} else if (deg > 78.75 && deg <= 101.25) {
|
} else if (deg > 78.75 && deg <= 101.25) {
|
||||||
return "E";
|
return "E";
|
||||||
} else if (deg > 101.25 && deg <= 123.75) {
|
} else if (deg > 101.25 && deg <= 123.75) {
|
||||||
return "ESE";
|
return "ESE";
|
||||||
} else if (deg > 123.75 && deg <= 146.25) {
|
} else if (deg > 123.75 && deg <= 146.25) {
|
||||||
return "SE";
|
return "SE";
|
||||||
} else if (deg > 146.25 && deg <= 168.75) {
|
} else if (deg > 146.25 && deg <= 168.75) {
|
||||||
return "SSE";
|
return "SSE";
|
||||||
} else if (deg > 168.75 && deg <= 191.25) {
|
} else if (deg > 168.75 && deg <= 191.25) {
|
||||||
return "S";
|
return "S";
|
||||||
} else if (deg > 191.25 && deg <= 213.75) {
|
} else if (deg > 191.25 && deg <= 213.75) {
|
||||||
return "SSW";
|
return "SSW";
|
||||||
} else if (deg > 213.75 && deg <= 236.25) {
|
} else if (deg > 213.75 && deg <= 236.25) {
|
||||||
return "SW";
|
return "SW";
|
||||||
} else if (deg > 236.25 && deg <= 258.75) {
|
} else if (deg > 236.25 && deg <= 258.75) {
|
||||||
return "WSW";
|
return "WSW";
|
||||||
} else if (deg > 258.75 && deg <= 281.25) {
|
} else if (deg > 258.75 && deg <= 281.25) {
|
||||||
return "W";
|
return "W";
|
||||||
} else if (deg > 281.25 && deg <= 303.75) {
|
} else if (deg > 281.25 && deg <= 303.75) {
|
||||||
return "WNW";
|
return "WNW";
|
||||||
} else if (deg > 303.75 && deg <= 326.25) {
|
} else if (deg > 303.75 && deg <= 326.25) {
|
||||||
return "NW";
|
return "NW";
|
||||||
} else if (deg > 326.25 && deg <= 348.75) {
|
} else if (deg > 326.25 && deg <= 348.75) {
|
||||||
return "NNW";
|
return "NNW";
|
||||||
} else {
|
} else {
|
||||||
return "N";
|
return "N";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user