mirror of
https://github.com/mtan93/homebridge.git
synced 2026-04-05 06:13:13 +01:00
5
app.js
5
app.js
@@ -8,6 +8,7 @@ var Accessory = require('HAP-NodeJS').Accessory;
|
|||||||
var Service = require('HAP-NodeJS').Service;
|
var Service = require('HAP-NodeJS').Service;
|
||||||
var Characteristic = require('HAP-NodeJS').Characteristic;
|
var Characteristic = require('HAP-NodeJS').Characteristic;
|
||||||
var accessoryLoader = require('HAP-NodeJS').AccessoryLoader;
|
var accessoryLoader = require('HAP-NodeJS').AccessoryLoader;
|
||||||
|
var once = require('HAP-NodeJS/lib/util/once').once;
|
||||||
|
|
||||||
console.log("Starting HomeBridge server...");
|
console.log("Starting HomeBridge server...");
|
||||||
|
|
||||||
@@ -118,7 +119,7 @@ function loadPlatforms() {
|
|||||||
|
|
||||||
function loadPlatformAccessories(platformInstance, log) {
|
function loadPlatformAccessories(platformInstance, log) {
|
||||||
asyncCalls++;
|
asyncCalls++;
|
||||||
platformInstance.accessories(function(foundAccessories){
|
platformInstance.accessories(once(function(foundAccessories){
|
||||||
asyncCalls--;
|
asyncCalls--;
|
||||||
|
|
||||||
// loop through accessories adding them to the list and registering them
|
// loop through accessories adding them to the list and registering them
|
||||||
@@ -137,7 +138,7 @@ function loadPlatformAccessories(platformInstance, log) {
|
|||||||
// were we the last callback?
|
// were we the last callback?
|
||||||
if (asyncCalls === 0 && !asyncWait)
|
if (asyncCalls === 0 && !asyncWait)
|
||||||
publish();
|
publish();
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function createAccessory(accessoryInstance, displayName) {
|
function createAccessory(accessoryInstance, displayName) {
|
||||||
|
|||||||
Reference in New Issue
Block a user