Skip to content

Commit 48d4364

Browse files
committed
ADDED: Support for displaying humidity values if data is provided by the sensor. Version bumped to 1.1.0.
1 parent 190d718 commit 48d4364

File tree

8 files changed

+32
-6
lines changed

8 files changed

+32
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
All notable changes to this project is documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org/).
55

6+
## [1.1.0]
7+
8+
- ADDED: Displaying humidity data if provided by the sensor.
9+
610
## [1.0.0]
711

812
First public release.

MMM-RemoteTemperature.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
.MMM-RemoteTemperature .symbol {
2-
margin-right: 10px;
2+
margin-right: 15px;
33
}
4+
5+
.MMM-RemoteTemperature .humidity {
6+
display: inline-block;
7+
margin-left: 10px;
8+
}
9+

MMM-RemoteTemperature.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ Module.register('MMM-RemoteTemperature', {
5656
tempEl.innerHTML = `${this.viewModel.temp}°`;
5757
firstLineEl.appendChild(tempEl);
5858

59+
if (this.viewModel.humidity) {
60+
const humidityEl = document.createElement('span');
61+
humidityEl.classList = "humidity";
62+
humidityEl.innerHTML = `${this.viewModel.humidity}%`;
63+
firstLineEl.appendChild(humidityEl);
64+
}
65+
5966
wrapper.appendChild(firstLineEl);
6067

6168
if (this.config.showTime) {
@@ -79,6 +86,7 @@ Module.register('MMM-RemoteTemperature', {
7986
if (!this.config.sensorId || (this.config.sensorId && this.config.sensorId === payload.sensorId)) {
8087
this.viewModel = {
8188
temp: payload.temp,
89+
humidity: payload.humidity,
8290
timestamp: Date.now()
8391
};
8492

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# MMM-RemoteTemperature
22

3-
This is a module for the [MagicMirror²](https://github.com/MichMich/MagicMirror/) to display temperature values from a remote sensor that is capable to POST the measured value through HTTP protocol.
3+
This is a module for the [MagicMirror²](https://github.com/MichMich/MagicMirror/) to display temperature and humidity values from a remote sensor that is capable to POST the measured values through HTTP protocol.
44

55
## Features
66

7-
By default this module displays the measured temperature, an icon and the time of the last update:
7+
By default this module displays the measured temperature, humidity, an icon and the time of the last update:
88

9-
![Default](https://raw.githubusercontent.com/balassy/MMM-RemoteTemperature/master/doc/screenshot-default.png)
9+
![Default](./doc/screenshot-with-humidity.png)
10+
11+
If the sensor does not send humidity data, then only the temperature is displayed:
12+
13+
![Default](./doc/screenshot-temp-only.png)
1014

1115
You can configure the module to display a custom icon:
1216

@@ -83,11 +87,14 @@ This module can work with any temperature sensor that is capable to periodically
8387
```javascript
8488
{
8589
"temp": 27,
90+
"humidity": 30.4,
8691
"sensorId": "1"
8792
}
8893
```
8994

90-
The `temp` property value must be a `number`, and must contain the measured temperature. It will be displayed on the mirror as is, without any conversion.
95+
The `temp` property value must be a `number`, and must contain the measured temperature. It will be displayed on the mirror as is, without any conversion, appended by the `°` symbol.
96+
97+
The `humidity` property value is optional, but if specified, it must be a number, and must contain the measured humidity represented in percentage. It will be displayed on the mirror as is, without any conversion, appended by the `%` symbol.
9198

9299
The `sensorId` property must be a `string`, and can contain any value, but it is important that it must match the `sensorId` specified for the module in the configuration. It is used to determine which module should display the value, if the module is added multiple times to the mirror. It can also be used as an API key to ensure that only authorized sensors can update the mirror.
93100

File renamed without changes.

doc/screenshot-with-humidity.png

2.67 KB
Loading

node_helper.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ module.exports = NodeHelper.create({
2222

2323
const payload = {
2424
temp: params.temp,
25+
humidity: params.humidity,
2526
sensorId: params.sensorId
2627
};
2728

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "MMM-RemoteTemperature",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "MagicMirror module that displays temperature value from a remote sensor.",
55
"main": "MMM-RemoteTemperature.js",
66
"author": "György Balássy",

0 commit comments

Comments
 (0)