App runs
This commit is contained in:
parent
dabdfc56a5
commit
b688b365fb
@ -1 +1,4 @@
|
|||||||
**/HAPNodeJS.d.ts
|
**/HAPNodeJS.d.ts
|
||||||
|
|
||||||
|
bin
|
||||||
|
node_modules
|
||||||
|
4001
package-lock.json
generated
4001
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "homebridge-automation",
|
"name": "homebridge-automation",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Homebridge plugin to expose and cast spotify playlists via the homekit app.",
|
"description": "Homebridge plugin for supervised home learning.",
|
||||||
"main": "bin/index.js",
|
"main": "bin/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npx eslint **/*.ts&&tsc",
|
"build": "npx eslint **/*.ts&&tsc",
|
||||||
@ -30,6 +30,7 @@
|
|||||||
"bonjour": "^3.5.0",
|
"bonjour": "^3.5.0",
|
||||||
"decamelize": "^3.2.0",
|
"decamelize": "^3.2.0",
|
||||||
"inflection": "^1.12.0",
|
"inflection": "^1.12.0",
|
||||||
|
"reflect-metadata": "^0.1.13",
|
||||||
"request": "^2.88.0",
|
"request": "^2.88.0",
|
||||||
"request-promise-native": "^1.0.7",
|
"request-promise-native": "^1.0.7",
|
||||||
"source-map-support": "^0.5.13",
|
"source-map-support": "^0.5.13",
|
||||||
@ -41,4 +42,4 @@
|
|||||||
"eslint": "^6.3.0",
|
"eslint": "^6.3.0",
|
||||||
"typescript": "^3.6.2"
|
"typescript": "^3.6.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
src/Services/index.ts
Normal file
3
src/Services/index.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import Monitor from './monitor';
|
||||||
|
|
||||||
|
export { Monitor };
|
19
src/index.ts
19
src/index.ts
@ -1,5 +1,9 @@
|
|||||||
|
import 'reflect-metadata';
|
||||||
|
import './Services';
|
||||||
import { log, Homebridge } from './Types/types';
|
import { log, Homebridge } from './Types/types';
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
|
import { container } from 'tsyringe';
|
||||||
|
import { Monitor } from './Services';
|
||||||
|
|
||||||
class AutomationPlatform {
|
class AutomationPlatform {
|
||||||
private log: log;
|
private log: log;
|
||||||
@ -12,6 +16,21 @@ class AutomationPlatform {
|
|||||||
this.api = api;
|
this.api = api;
|
||||||
this.log('INFO - Registering automation platform');
|
this.log('INFO - Registering automation platform');
|
||||||
this.api.on('didFinishLaunching', this.didFinishLaunching.bind(this));
|
this.api.on('didFinishLaunching', this.didFinishLaunching.bind(this));
|
||||||
|
this.main();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by homebridge to gather accessories.
|
||||||
|
* @param callback
|
||||||
|
*/
|
||||||
|
accessories = (callback: (accessories: Array<unknown>) => void): void => {
|
||||||
|
callback([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private main = (): void => {
|
||||||
|
//Register the log function for DI
|
||||||
|
container.register("log", { useValue: this.log });
|
||||||
|
container.resolve(Monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,19 +1,16 @@
|
|||||||
import { HapClient } from "../HapClient";
|
import { HapClient } from "../HapClient";
|
||||||
import { log } from '../Types/types';
|
import { log } from '../Types/types';
|
||||||
import { singleton } from 'tsyringe';
|
import { singleton, inject } from 'tsyringe';
|
||||||
|
|
||||||
export interface IMonitorProps {
|
|
||||||
log: log;
|
|
||||||
}
|
|
||||||
|
|
||||||
@singleton()
|
@singleton()
|
||||||
export class Monitor {
|
export default class Monitor {
|
||||||
private log: log;
|
private log: log;
|
||||||
private api: any;
|
private api: any;
|
||||||
private client: HapClient;
|
private client: HapClient;
|
||||||
|
|
||||||
constructor(props: IMonitorProps) {
|
constructor(@inject("log") log: log) {
|
||||||
this.log = props.log;
|
this.log = log;
|
||||||
|
|
||||||
this.client = new HapClient({
|
this.client = new HapClient({
|
||||||
pin: "031-45-154",
|
pin: "031-45-154",
|
||||||
|
Loading…
Reference in New Issue
Block a user