mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
15
app.js
15
app.js
@@ -21,12 +21,15 @@ if (!fs.existsSync(configPath)) {
|
||||
// Initialize HAP-NodeJS
|
||||
hap.init();
|
||||
|
||||
// Start by creating our Bridge which will host all loaded Accessories
|
||||
var bridge = new Bridge('HomeBridge', uuid.generate("HomeBridge"));
|
||||
|
||||
// Load up the configuration file
|
||||
var config = JSON.parse(fs.readFileSync(configPath));
|
||||
|
||||
// pull out our custom Bridge settings from config.json, if any
|
||||
var bridgeConfig = config.bridge || {};
|
||||
|
||||
// Start by creating our Bridge which will host all loaded Accessories
|
||||
var bridge = new Bridge(bridgeConfig.name || 'Homebridge', uuid.generate("HomeBridge"));
|
||||
|
||||
// keep track of async calls we're waiting for callbacks on before we can start up
|
||||
// this is hacky but this is all going away once we build proper plugin support
|
||||
var asyncCalls = 0;
|
||||
@@ -139,9 +142,9 @@ function loadPlatforms() {
|
||||
|
||||
function publish() {
|
||||
bridge.publish({
|
||||
username: "CC:22:3D:E3:CE:27",
|
||||
port: 51826,
|
||||
pincode: "031-45-154",
|
||||
username: bridgeConfig.username || "CC:22:3D:E3:CE:27",
|
||||
port: bridgeConfig.port || 51826,
|
||||
pincode: bridgeConfig.pin || "031-45-154",
|
||||
category: Accessory.Categories.OTHER
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
{
|
||||
"bridge": {
|
||||
"name": "Homebridge",
|
||||
"username": "CC:22:3D:E3:CE:27",
|
||||
"port": 51826,
|
||||
"pin": "031-45-154"
|
||||
},
|
||||
|
||||
"description": "This is an example configuration file with all supported devices. You can use this as a template for creating your own configuration file containing devices you actually own.",
|
||||
|
||||
"platforms": [
|
||||
|
||||
Reference in New Issue
Block a user