aboutsummaryrefslogtreecommitdiff
path: root/plugin.ts
diff options
context:
space:
mode:
Diffstat (limited to 'plugin.ts')
-rw-r--r--plugin.ts83
1 files changed, 26 insertions, 57 deletions
diff --git a/plugin.ts b/plugin.ts
index 01af191..04664e1 100644
--- a/plugin.ts
+++ b/plugin.ts
@@ -1,73 +1,42 @@
import {
API,
- Characteristic,
- DynamicPlatformPlugin,
+ AccessoryPlugin,
Logger,
- PlatformAccessory,
- PlatformConfig,
- Service,
+ AccessoryConfig,
+ Service
+
} from 'homebridge';
-export default class BekenBridge implements DynamicPlatformPlugin {
- public readonly Service: typeof Service = this.api.hap.Service;
- public readonly Characteristic: typeof Characteristic = this.api.hap.Characteristic;
+import Lamp, { LampColor } from './lamp';
+
+export default class BekenBridge implements AccessoryPlugin {
+ private lamp: Lamp;
+ private bulbService: Service;
+ private infoService: Service;
- public readonly accessories: PlatformAccessory[] = [];
+ public name: string;
constructor(
public readonly log: Logger,
- public readonly config: PlatformConfig,
+ public readonly config: AccessoryConfig,
public readonly api: API,
) {
- this.log.debug('Loaded BekenBridge');
-
- this.api.on('didFinishLaunching', () => {
- log.debug('Executed didFinishLaunching callback');
- this.discoverDevices();
- });
- }
+ console.log("reached constructor"); //DEBUG
+ // this.name = config.name;
+ // this.lamp = new Lamp(config.address);
- configureAccessory(accessory: PlatformAccessory) {
- this.log.info('Loading accessory from cache:', accessory.displayName);
+ // this.infoService = new this.api.hap.Service.AccessoryInformation()
+ // .setCharacteristic(this.api.hap.Characteristic.Manufacturer, "Beken")
+ // .setCharacteristic(this.api.hap.Characteristic.Model, "Beken LED");
- this.accessories.push(accessory);
+ // this.bulbService = new this.api.hap.Service.Lightbulb(this.name);
}
-
- discoverDevices() {
- this.log.info('gert');
- // const exampleDevices = [
- // {
- // exampleUniqueId: 'ABCD',
- // exampleDisplayName: 'Bedroom',
- // },
- // {
- // exampleUniqueId: 'EFGH',
- // exampleDisplayName: 'Kitchen',
- // },
- // ];
-
- // for (const device of exampleDevices) {
-
- // const uuid = this.api.hap.uuid.generate(device.exampleUniqueId);
-
- // const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid);
-
- // if (existingAccessory) {
- // this.log.info('Restoring existing accessory from cache:', existingAccessory.displayName);
-
- // new ExamplePlatformAccessory(this, existingAccessory);
-
- // } else {
- // this.log.info('Adding new accessory:', device.exampleDisplayName);
-
- // const accessory = new this.api.platformAccessory(device.exampleDisplayName, uuid);
-
- // accessory.context.device = device;
-
- // new ExamplePlatformAccessory(this, accessory);
-
- // this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
- // }
- // }
+
+ getServices() {
+ console.log("getting services"); //DEBUG
+ return [
+ // this.infoService,
+ // this.bulbService
+ ];
}
}