5 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
4 changed files with 20 additions and 13 deletions

View File

@@ -190,6 +190,7 @@ SamplePlatform.prototype.addAccessory = function(accessoryName) {
// To help restore accessory in configureAccessory() // To help restore accessory in configureAccessory()
// newAccessory.context.something = "Something" // 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") newAccessory.addService(Service.Lightbulb, "Test Light")
.getCharacteristic(Characteristic.On) .getCharacteristic(Characteristic.On)
.on('set', function(value, callback) { .on('set', function(value, callback) {

View File

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

View File

@@ -23,7 +23,9 @@ module.exports = {
Server: Server Server: Server
} }
function Server(insecureAccess) { function Server(insecureAccess, opts) {
opts = opts || {};
// Setup Accessory Cache Storage // Setup Accessory Cache Storage
accessoryStorage.initSync({ dir: User.cachedAccessoryPath() }); accessoryStorage.initSync({ dir: User.cachedAccessoryPath() });
@@ -46,7 +48,7 @@ function Server(insecureAccess) {
}.bind(this)); }.bind(this));
this._plugins = this._loadPlugins(); // plugins[name] = Plugin instance this._plugins = this._loadPlugins(); // plugins[name] = Plugin instance
this._config = this._loadConfig(); this._config = opts.config || this._loadConfig();
this._cachedPlatformAccessories = this._loadCachedPlatformAccessories(); this._cachedPlatformAccessories = this._loadCachedPlatformAccessories();
this._bridge = this._createBridge(); this._bridge = this._createBridge();

View File

@@ -1,7 +1,7 @@
{ {
"name": "homebridge", "name": "homebridge",
"description": "HomeKit support for the impatient", "description": "HomeKit support for the impatient",
"version": "0.4.9", "version": "0.4.10",
"scripts": { "scripts": {
"dev": "DEBUG=* ./bin/homebridge -D -P example-plugins/ || true" "dev": "DEBUG=* ./bin/homebridge -D -P example-plugins/ || true"
}, },