16 Commits

Author SHA1 Message Date
Khaos Tian
4884087041 0.4.10 2016-11-27 15:24:43 -08:00
Khaos Tian
e1867b2bc0 Improve error handling. 2016-11-27 15:24:27 -08:00
Khaos Tian
4d0f9d86f6 Merge pull request #941 from djMax/master
Allow externally specified config
2016-11-21 12:04:57 -08:00
Max Metral
ecda18029f Allow externally specified config 2016-11-21 14:58:39 -05:00
Khaos Tian
efc570e5a9 Update example plugin
Add comment for service name.
2016-11-18 00:33:36 -08:00
Khaos Tian
b6cfe3ba7c 0.4.9 2016-11-09 18:11:57 -08:00
Khaos Tian
f836d4a42c Bump hap-nodejs version to fix #791 2016-11-09 18:11:41 -08:00
Khaos Tian
63ab1025e9 Update hap-nodejs to allow homebridge work with nodejs v4.x 2016-11-03 12:20:46 -07:00
Khaos Tian
dc43d0b7c4 Update hap-nodejs
This version requires node v5.10.0 or later.
2016-11-01 18:33:59 -07:00
Khaos Tian
7c3543ba61 Merge pull request #839 from rxseger/collision-name
Fix camera name in collision error message
2016-10-09 17:14:29 -07:00
rxseger
5adb5f3282 Fix camera name in collision error message 2016-10-09 23:36:53 +00:00
Khaos Tian
fedd341970 0.4.6 2016-10-01 16:48:05 -07:00
Khaos Tian
c7c9aa0150 Bump hap-nodejs version. 2016-10-01 16:48:01 -07:00
Khaos Tian
e3e08414f6 0.4.5 2016-09-28 17:11:01 -07:00
Khaos Tian
ea9df45d2d Add back the ability to designate the port homebridge is running. 2016-09-28 17:10:52 -07:00
Khaos Tian
7425f8beca 0.4.4 2016-09-28 12:40:35 -07:00
4 changed files with 23 additions and 15 deletions

View File

@@ -189,7 +189,8 @@ SamplePlatform.prototype.addAccessory = function(accessoryName) {
// Plugin can save context on accessory
// To help restore accessory in configureAccessory()
// newAccessory.context.something = "Something"
// Make sure you provided a name for service otherwise it may not visible in some HomeKit apps.
newAccessory.addService(Service.Lightbulb, "Test Light")
.getCharacteristic(Characteristic.On)
.on('set', function(value, callback) {

View File

@@ -165,9 +165,13 @@ Plugin.installed = function() {
// reconstruct full path
var pluginPath = path.join(requirePath, name);
// we only care about directories
if (!fs.statSync(pluginPath).isDirectory()) continue;
try {
// we only care about directories
if (!fs.statSync(pluginPath).isDirectory()) continue;
} catch (e) {
continue;
}
// does this module contain a package.json?
var pjson;

View File

@@ -23,7 +23,9 @@ module.exports = {
Server: Server
}
function Server(insecureAccess) {
function Server(insecureAccess, opts) {
opts = opts || {};
// Setup Accessory Cache Storage
accessoryStorage.initSync({ dir: User.cachedAccessoryPath() });
@@ -46,7 +48,7 @@ function Server(insecureAccess) {
}.bind(this));
this._plugins = this._loadPlugins(); // plugins[name] = Plugin instance
this._config = this._loadConfig();
this._config = opts.config || this._loadConfig();
this._cachedPlatformAccessories = this._loadCachedPlatformAccessories();
this._bridge = this._createBridge();
@@ -55,7 +57,7 @@ function Server(insecureAccess) {
this._publishedCameras = {};
this._setupManager = new BridgeSetupManager();
this._setupManager.on('newConfig', this._handleNewConfig.bind(this));
this._setupManager.on('requestCurrentConfig', function(callback) {
callback(this._config);
}.bind(this));
@@ -93,7 +95,7 @@ Server.prototype.run = function() {
Server.prototype._publish = function() {
// pull out our custom Bridge settings from config.json, if any
var bridgeConfig = this._config.bridge || {};
var info = this._bridge.getService(Service.AccessoryInformation);
if (bridgeConfig.manufacturer)
info.setCharacteristic(Characteristic.Manufacturer, bridgeConfig.manufacturer);
@@ -110,6 +112,7 @@ Server.prototype._publish = function() {
this._bridge.publish({
username: bridgeConfig.username || "CC:22:3D:E3:CE:30",
port: bridgeConfig.port || 0,
pincode: bridgeConfig.pin || "031-45-154",
category: Accessory.Categories.BRIDGE
}, this._allowInsecureAccess);
@@ -167,7 +170,7 @@ Server.prototype._loadConfig = function() {
// Complain and exit if it doesn't exist yet
if (!fs.existsSync(configPath)) {
log.warn("config.json (%s) not found.", configPath);
var config = {};
config.bridge = {
@@ -426,7 +429,7 @@ Server.prototype._handleRegisterPlatformAccessories = function(accessories) {
accessory._prepareAssociatedHAPAccessory();
hapAccessories.push(accessory._associatedHAPAccessory);
this._cachedPlatformAccessories.push(accessory);
}
@@ -472,7 +475,7 @@ Server.prototype._handlePublishCameraAccessories = function(accessories) {
var advertiseAddress = mac.generate(accessory.UUID);
if (this._publishedCameras[advertiseAddress]) {
throw new Error("Camera accessory %s experienced an address collision.", accessory.displayName);
throw new Error("Camera accessory " + accessory.displayName + " experienced an address collision.");
} else {
this._publishedCameras[advertiseAddress] = accessory;
}
@@ -512,7 +515,7 @@ Server.prototype._handleNewConfig = function(type, name, replace, config) {
} else {
var targetName;
if (name.indexOf('.') !== -1) {
targetName = name.split(".")[1];
targetName = name.split(".")[1];
}
var found = false;
for (var index in this._config.accessories) {
@@ -544,7 +547,7 @@ Server.prototype._handleNewConfig = function(type, name, replace, config) {
} else {
var targetName;
if (name.indexOf('.') !== -1) {
targetName = name.split(".")[1];
targetName = name.split(".")[1];
}
var found = false;

View File

@@ -1,7 +1,7 @@
{
"name": "homebridge",
"description": "HomeKit support for the impatient",
"version": "0.4.3",
"version": "0.4.10",
"scripts": {
"dev": "DEBUG=* ./bin/homebridge -D -P example-plugins/ || true"
},
@@ -26,7 +26,7 @@
"dependencies": {
"chalk": "^1.1.1",
"commander": "2.8.1",
"hap-nodejs": "0.4.8",
"hap-nodejs": "0.4.15",
"semver": "5.0.3",
"node-persist": "^0.0.8"
}