-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
58 lines (42 loc) · 1.69 KB
/
index.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
51
52
53
54
55
56
57
58
"use strict";
var Service, Characteristic, HomebridgeAPI;
module.exports = function(homebridge) {
Service = homebridge.hap.Service;
Characteristic = homebridge.hap.Characteristic;
HomebridgeAPI = homebridge;
homebridge.registerAccessory("homebridge-wordclock", "Wordclock", Wordclock);
}
function Wordclock(log, config) {
this.log = log;
this.name = config.name;
this.ip = config.ip;
this.port = config.port || 2424;
this.stateful = config.stateful;
this.reverse = config.reverse;
this.manufacturer = config.manufacturer || 'Mikrocontroller.net';
this.model = config.model;
this.serial = config.serial || 1;
}
Wordclock.prototype.getServices = function() {
var informationService = new Service.AccessoryInformation();
informationService
.setCharacteristic(Characteristic.FirmwareRevision, '1.0.6a')
.setCharacteristic(Characteristic.Manufacturer, this.manufacturer)
.setCharacteristic(Characteristic.Model, this.model)
.setCharacteristic(Characteristic.SerialNumber, this.serial);
var wordclockLightService = new Service.Lightbulb(this.name);
wordclockLightService
.getCharacteristic(Characteristic.On);
wordclockLightService
.addCharacteristic(new Characteristic.Hue());
wordclockLightService
.addCharacteristic(new Characteristic.Saturation());
wordclockLightService
.addCharacteristic(new Characteristic.Brightness());
var wordclockTempService = new Service.TemperatureSensor(this.name);
wordclockTempService
.getCharacteristic(Characteristic.CurrentTemperature);
return [informationService, wordclockLightService, wordclockTempService];
}
Wordclock.prototype._setOn = function(on, callback) {
}