-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMMM-CECControl.js
50 lines (43 loc) · 1.18 KB
/
MMM-CECControl.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
39
40
41
42
43
44
45
46
47
48
49
50
/* Magic Mirror
* Module: MMM-CECControl
*
* By Thierry Nischelwitzer http://nischi.ch
* MIT Licensed.
*/
Module.register('MMM-CECControl', {
defaults: {
comport: 'RPI',
offOnStartup: true,
xscreensaver: false,
useCustomCmd: false,
customCmdOn: 'vcgencmd display_power 1',
customCmdOff: 'vcgencmd display_power 0',
},
sendSocketNotificationWrapper: function(text, payload) {
this.sendSocketNotification(text, payload);
},
log: function(message) {
Log.log(message);
},
start: function() {
this.sendSocketNotificationWrapper('CONFIG', this.config);
if (this.config.offOnStartup) {
this.sendSocketNotificationWrapper('CECControl', 'off');
}
},
socketNotificationReceived: function(notification, payload) {
this.log(
this.name +
' received a socket notification: ' +
notification +
' - Payload: ' +
payload
);
},
notificationReceived: function(notification, payload, sender) {
if (notification === 'CECControl') {
this.log(this.name + ' received a module notification: ' + notification);
this.sendSocketNotificationWrapper('CECControl', payload);
}
},
});