Using TS types. Not building
This commit is contained in:
@ -1,30 +1,26 @@
|
||||
import HarmonyDataProvider from "../DataProviders/HarmonyDataProvider";
|
||||
import { IDeviceButton } from "../Models/Config";
|
||||
import { IAccessory } from "./IAccessory";
|
||||
import { ICommand } from "../Models";
|
||||
import { HarmonyDevice } from "../Models/HarmonyDevice";
|
||||
|
||||
let Service: HAPNodeJS.Service;
|
||||
let Characteristic: HAPNodeJS.Characteristic;
|
||||
import { Service, PlatformAccessory, AccessoryPlugin, API, Characteristic } from "homebridge";
|
||||
|
||||
export interface IDeviceButtonProps {
|
||||
dataProvider: HarmonyDataProvider,
|
||||
buttonName: string,
|
||||
displayName: string,
|
||||
deviceInfo: IDeviceButton,
|
||||
api: any,
|
||||
api: API,
|
||||
log: any,
|
||||
homebridge: any,
|
||||
}
|
||||
|
||||
export class DeviceButton implements IAccessory {
|
||||
private _api: any;
|
||||
export class DeviceButton implements AccessoryPlugin {
|
||||
private _api: API;
|
||||
private _homebridge: any;
|
||||
private _log: any = {};
|
||||
|
||||
//Service fields
|
||||
private _switchService: HAPNodeJS.Service;
|
||||
private _infoService: HAPNodeJS.Service;
|
||||
private _switchService: Service;
|
||||
private _infoService: Service;
|
||||
|
||||
private _buttonInfo: IDeviceButton;
|
||||
|
||||
@ -38,10 +34,7 @@ export class DeviceButton implements IAccessory {
|
||||
//Assign class variables
|
||||
this._log = props.log;
|
||||
this._api = props.api;
|
||||
Service = props.api.hap.Service;
|
||||
Characteristic = props.api.hap.Characteristic;
|
||||
this.name = props.displayName;
|
||||
this._homebridge = props.homebridge;
|
||||
|
||||
this._buttonInfo = props.deviceInfo;
|
||||
|
||||
@ -88,7 +81,7 @@ export class DeviceButton implements IAccessory {
|
||||
/**
|
||||
* Called by homebridge to gather services.
|
||||
*/
|
||||
public getServices = (): Array<HAPNodeJS.Service> => {
|
||||
public getServices = (): Array<Service> => {
|
||||
return [this._infoService, this._switchService!];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user