mirror of
https://github.com/mtan93/homebridge.git
synced 2026-04-26 22:05:59 +01:00
@@ -21,12 +21,15 @@ if (!fs.existsSync(configPath)) {
|
|||||||
// Initialize HAP-NodeJS
|
// Initialize HAP-NodeJS
|
||||||
hap.init();
|
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
|
// Load up the configuration file
|
||||||
var config = JSON.parse(fs.readFileSync(configPath));
|
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
|
// 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
|
// this is hacky but this is all going away once we build proper plugin support
|
||||||
var asyncCalls = 0;
|
var asyncCalls = 0;
|
||||||
@@ -139,9 +142,9 @@ function loadPlatforms() {
|
|||||||
|
|
||||||
function publish() {
|
function publish() {
|
||||||
bridge.publish({
|
bridge.publish({
|
||||||
username: "CC:22:3D:E3:CE:27",
|
username: bridgeConfig.username || "CC:22:3D:E3:CE:27",
|
||||||
port: 51826,
|
port: bridgeConfig.port || 51826,
|
||||||
pincode: "031-45-154",
|
pincode: bridgeConfig.pin || "031-45-154",
|
||||||
category: Accessory.Categories.OTHER
|
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.",
|
"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": [
|
"platforms": [
|
||||||
|
|||||||
Reference in New Issue
Block a user