-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMMM-iCloud-Client.js
More file actions
49 lines (44 loc) · 1.17 KB
/
MMM-iCloud-Client.js
File metadata and controls
49 lines (44 loc) · 1.17 KB
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
39
40
41
42
43
44
45
46
47
48
49
/* global Module */
/* MagicMirror²
* Module: MMM-iCloud-Client
*
* By Jonathan Vogt https://github.com/bitte-ein-bit
* MIT Licensed.
*/
Module.register("MMM-iCloud-Client", {
// Default module config.
defaults: {
username: "",
password: "",
countrycode: "49",
},
start: function () {
//Open Socket connection
this.sendSocketNotification("CONFIG", this.config);
Log.info(`Starting module: ${this.name}`);
},
notificationReceived: function (notification, payload, sender) {
if (sender) {
Log.log(
`${this.name} received a module notification: ${notification} from sender: ${sender.name}`,
);
} else {
Log.log(`${this.name} received a system notification: ${notification}`);
}
if (notification === "PHONE_LOOKUP") {
this.sendSocketNotification("PHONE_LOOKUP", {
number: payload.number,
reason: payload.reason,
sender: sender.name,
});
}
},
socketNotificationReceived: function (notification, payload) {
Log.log(
`${this.name} received a socket notification: ${notification} - Payload: ${payload}`,
);
if (notification === "PHONE_LOOKUP_RESULT") {
this.sendNotification("PHONE_LOOKUP_RESULT", payload);
}
},
});