-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.js
executable file
·28 lines (23 loc) · 919 Bytes
/
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
const SpotifyPlatform = require('./homebridge_rusty_spotify.js').SpotifyPlatform;
function partial(fn /*, rest args */){
return fn.bind.apply(fn, Array.apply(null, arguments));
}
module.exports = function(homebridge) {
Accessory = homebridge.platformAccessory;
Service = homebridge.hap.Service;
UUIDGen = homebridge.hap.uuid;
Characteristic = homebridge.hap.Characteristic;
createLight = function(name) {
let newSwitch = new Service.Lightbulb(name);
// we'll use brightness to control the volume
newSwitch.addCharacteristic(Characteristic.Brightness);
return newSwitch;
}
createSpeaker = function(name) {
let newSpeaker = new Service.Speaker(name);
newSpeaker.addCharacteristic(Characteristic.Volume);
return newSpeaker;
}
constructor = partial(SpotifyPlatform, homebridge);
homebridge.registerPlatform("homebridge-rusty-spotify", "Spotify", constructor, true);
}