-
Notifications
You must be signed in to change notification settings - Fork 0
/
MMM-OTIS.js
38 lines (32 loc) · 947 Bytes
/
MMM-OTIS.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
32
33
34
35
36
37
38
//MMM-OTIS.js:
Module.register("MMM-OTIS", {
// Default module config.
text: "O.T.I.S 1.0",
defaults: {
language: "en",
text: "Hello World!"
},
replyToText: function(text) {
this.sendNotification("MMM-TTS", text);
},
notificationReceived: function(notification, payload, sender) {
if (notification === "REPLY_TO_TEXT") {
this.sendSocketNotification('GET_ANSWER', payload);
}
},
socketNotificationReceived(notification, payload) {
if (notification === 'ANSWER') {
this.replyToText(payload);
}
},
getDom: function() {
var wrapper = document.createElement("div");
wrapper.className = "small light";
wrapper.innerHTML = this.text;
return wrapper;
},
start() {
Log.info(`Starting module: ${this.name}`);
this.sendSocketNotification('CONFIG', this.config);
},
});