-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
26 lines (24 loc) · 958 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
const OpenGarageModule = require("./lib/open_garage.js")
const OpenGarageApiModule = require("./lib/open_garage_api.js")
module.exports = function( homebridge ) {
let Service = homebridge.hap.Service
let Characteristic = homebridge.hap.Characteristic
class OpenGarageConnect {
constructor(log, config) {
let OpenGarageApi = OpenGarageApiModule(log)
let openGarageApi = new OpenGarageApi({
ip: config.ip,
key: config.key
})
let OpenGarage = OpenGarageModule(log, config, {Service, Characteristic, openGarageApi, setTimeout, clearTimeout, Date})
this.openGarage = new OpenGarage(config.name, true)
}
getServices() {
return([
this.openGarage.garageService,
this.openGarage.vehicleService,
])
}
}
homebridge.registerAccessory( "homebridge-og", "OpenGarage", OpenGarageConnect );
};