-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnode_helper.js
More file actions
23 lines (22 loc) · 861 Bytes
/
node_helper.js
File metadata and controls
23 lines (22 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var NodeHelper = require("node_helper"),
RpiLeds = require('rpi-leds'),
leds = new RpiLeds(),
Enums = require("./shared/enums.js");
module.exports = NodeHelper.create({
socketNotificationReceived: function socketNotificationReceived(notification, payload) {
if (notification === Enums.NOTIFICATIONS.CONFIG) {
switch (payload.ledMode) {
case Enums.LED_MODES.OFF:
leds.power.turnOff();
leds.status.turnOff();
break;
case Enums.LED_MODES.HEART_BEAT:
leds.power.turnOff();
leds.status.heartbeat();
break;
default:
console.warn("LED Mode " + payload.ledMode + " is not known! 0 = LEDs OFF, 1 = Heart beat");
}
}
}
});