-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
35 lines (26 loc) · 1019 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
29
30
31
32
33
34
35
'use strict';
const HuePlatform = require('./lib/HuePlatform');
let Accessory;
let Service;
let Characteristic;
let UUIDGen;
module.exports = function (homebridge) {
Accessory = homebridge.platformAccessory;
Service = homebridge.hap.Service;
Characteristic = homebridge.hap.Characteristic;
UUIDGen = homebridge.hap.uuid;
homebridge.registerPlatform(HuePlatform.pluginName, HuePlatform.platformName, Platform, false);
};
function Platform(log, config, api) {
this.log = log;
this.api = api;
this.platform = new HuePlatform.HuePlatform(Accessory, Service, Characteristic, UUIDGen, log, config, api);
}
Platform.prototype.configureAccessory = function (accessory) {
this.log.info(`Configuring accessory '${accessory.displayName}'...`);
this.platform.configureAccessory(accessory);
};
Platform.prototype.configurationRequestHandler = function (context, request, callback) {
this.log.info('Configuration request...');
this.platform.handleConfigurationRequest(context, request, callback);
};