-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode_helper.js
31 lines (28 loc) · 872 Bytes
/
node_helper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* Magic Mirror
* Node Helper: MMM-WH2600
*
* By Stefan Nachtrab
* MIT Licensed.
*/
var NodeHelper = require("node_helper");
const WH2600 = require("./WH2600");
module.exports = NodeHelper.create({
/* socketNotificationReceived(notification, payload)
* This method is called when a socket notification arrives.
*
* argument notification string - The identifier of the noitication.
* argument payload mixed - The payload of the notification.
*/
socketNotificationReceived: function (notification, payload) {
var self = this;
if (notification === "MMM-WH2600-NOTIFICATION_CURRENTDATA_REQUESTED") {
new WH2600(payload.config.ipWH2600).getLiveData().then((body) => {
console.log(body);
self.sendSocketNotification(
"MMM-WH2600-NOTIFICATION_CURRENTDATA_RECEIVED",
body
);
});
}
}
});