mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-15 05:10:55 +00:00
Convert to ES5, add web server
* No compilation step * Beginnings of web interface * Simple express server; React-based frontend * CommonJS style across codebase; auto-converts to RequireJS for browser * Using diffsync for realtime UI * "Provider" -> "Plugin" * Plugins expose one or more Providers
This commit is contained in:
41
example-plugins/homebridge-lockitron/index.js
Normal file
41
example-plugins/homebridge-lockitron/index.js
Normal file
@@ -0,0 +1,41 @@
|
||||
var request = require('basic-request');
|
||||
var hap = require('HAP-NodeJS');
|
||||
|
||||
module.exports = {
|
||||
providers: [LockitronProvider]
|
||||
}
|
||||
|
||||
function LockitronProvider(log, config) {
|
||||
this._log = log;
|
||||
this._config = config;
|
||||
}
|
||||
|
||||
LockitronProvider.title = "Lockitron";
|
||||
|
||||
LockitronProvider.config = {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
description: "You can find your personal Access Token at: https://api.lockitron.com",
|
||||
required: true
|
||||
},
|
||||
lockID: {
|
||||
type: 'string',
|
||||
description: "If specified, only the lock with this ID will be exposed as an accessory.",
|
||||
}
|
||||
}
|
||||
|
||||
LockitronProvider.prototype.validateConfig = function(callback) {
|
||||
|
||||
// validate the accessToken
|
||||
var accessToken = this._config.accessToken;
|
||||
|
||||
// prove that we got a value
|
||||
this._log.info('Access Token: ' + accessToken);
|
||||
|
||||
// all is well.
|
||||
callback();
|
||||
}
|
||||
|
||||
LockitronProvider.prototype.getAccessories = function(callback) {
|
||||
|
||||
}
|
||||
15
example-plugins/homebridge-lockitron/package.json
Normal file
15
example-plugins/homebridge-lockitron/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "plugin-lockitron",
|
||||
"version": "0.0.0",
|
||||
"description": "Lockitron Support for HomeBridge",
|
||||
"license": "ISC",
|
||||
"keywords": [
|
||||
"homebridge-plugin"
|
||||
],
|
||||
"peerDepdendencies": {
|
||||
"homebridge": ">=0.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"basic-request": "^0.1.1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user