@o-lukas/homebridge-smartthings-tv
Version:
This is a plugin for Homebridge. It offers some basic functions to control Samsung TVs using the SmartThings API.
165 lines (164 loc) • 7.12 kB
TypeScript
import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig, Service, Characteristic } from 'homebridge';
import { SmartThingsClient, Device, Component, RefreshTokenStore, AuthData, RefreshData, Authenticator } from '@smartthings/core-sdk';
/**
* Class implements the configured Device to mac and ip address mappings.
*/
declare class DeviceMapping {
readonly deviceId: string;
readonly nameOverride: string;
readonly macAddress: string;
readonly ipAddress: string;
readonly inputSources: [{
name: string;
id: string;
}];
readonly applications: [{
name: string;
ids: [string];
}];
readonly validateApplications: boolean;
readonly infoKey: string;
readonly category: number;
constructor(deviceId: string, nameOverride: string, macAddress: string, ipAddress: string, inputSources: [{
name: string;
id: string;
}], applications: [{
name: string;
ids: [string];
}], validateApplications: boolean, infoKey: string, category: number);
}
/**
* Class implements the plugin platform.
*/
export declare class SmartThingsPlatform implements DynamicPlatformPlugin, RefreshTokenStore {
readonly log: Logger;
readonly config: PlatformConfig;
readonly api: API;
readonly Service: typeof Service;
readonly Characteristic: typeof Characteristic;
private configPath;
private authData;
readonly accessories: PlatformAccessory[];
constructor(log: Logger, config: PlatformConfig, api: API);
/**
* @inheritdoc
*/
getRefreshData(): Promise<RefreshData>;
/**
* @inheritdoc
*/
putAuthData(data: AuthData): Promise<void>;
/**
* @inheritdoc
*/
configureAccessory(accessory: PlatformAccessory): void;
/**
* Reads the platform configuration from the file system.
*
* @returns the platform configuration
*/
getPlatformConfig(): any;
/**
* Writes the platform configuration passed in to the file system.
*
* @param platformConfig the new platform configuration
*/
savePlatformConfig(platformConfig: unknown): void;
/**
* Uses the SmartThings API to discover and register the available devices.
*
* @param token the SmartThings API token
* @param deviceBlocklist the device ids to be ignored
* @param deviceMappings the array of configured DeviceMapping
* @param tvDeviceTypes the array of configured TV device types
* @param soundbarDeviceTypes the array of configured SoundBar device types
*/
discoverDevices(authenticator: Authenticator, deviceBlocklist: [string], deviceMappings: [DeviceMapping], tvDeviceTypes: [string], soundbarDeviceTypes: [string]): Promise<void>;
/**
* Registers a SmartThings Device for Homebridge.
*
* @param client the SmartThingsClient used to send API calls
* @param device the SmartThings Device
* @param deviceMappings the array of configured DeviceMapping
* @param tvDeviceTypes the array of configured TV device types
* @param soundbarDeviceTypes the array of configured SoundBar device types
* @returns the PlatformAccessory that must be published as external accessory or undefined
* if accessory must not be published as external accessory
*/
registerDevice(client: SmartThingsClient, device: Device, deviceMappings: [DeviceMapping], tvDeviceTypes: [string], soundbarDeviceTypes: [string]): Promise<PlatformAccessory[]>;
/**
* Registers a SmartThings TV Device for Homebridge.
*
* @param client the SmartThingsClient used to send API calls
* @param device the SmartThings Device
* @param accessory the cached PlatformAccessory or undefined if no cached PlatformAccessory exists
* @param deviceMappings the array of configured DeviceMapping
* @returns the PlatformAccessory that must be published as external accessory or undefined
* if device could not be registered
*/
registerTvDevice(client: SmartThingsClient, device: Device, deviceMapping: DeviceMapping | undefined): Promise<PlatformAccessory[]>;
/**
* Registers a SmartThings Soundbar Device for Homebridge.
*
* @param client the SmartThingsClient used to send API calls
* @param device the SmartThings Device
* @param accessory the cached PlatformAccessory or undefined if no cached PlatformAccessory exists
* @param deviceMappings the array of configured DeviceMapping
* @returns the PlatformAccessory that must be published as external accessory or undefined
* if device could not be registered
*/
registerSoundbarDevice(client: SmartThingsClient, device: Device, deviceMapping: DeviceMapping | undefined): Promise<PlatformAccessory[]>;
/**
* Register the modes of the device passed in as platform accessories.
* Handles caching of accessories as well.
*
* @param client the SmartThingsClient used to send API calls
* @param device the SmartThings Device
* @param component the SmartThings Device's Component
* @param stateful flag if switch will be stateful (set to TRUE to get capability status and reflect changes in switch)
* @param modes the modes to register
*/
registerModeSwitches(client: SmartThingsClient, device: Device, component: Component, stateful: boolean, modes: {
capability: string;
command: string;
prefix: string;
values: {
id: string;
name: string;
value: string;
}[];
}): void;
/**
* Registers a switch for parameters passed in.
* Handles caching of accessories as well.
*
* @param client the SmartThingsClient used to send API calls
* @param device the SmartThings Device
* @param component the SmartThings Device's Component
* @param name the switch's name
* @param id the switch's id
* @param capability the capability identifier
* @param command the command identifier
* @param value the value to set
* @param stateful flag if switch will be stateful (set to TRUE to get capability status and reflect changes in switch)
*/
registerSwitch(client: SmartThingsClient, device: Device, component: Component, name: string, id: string, capability: string, command: string, value: string | undefined, stateful: boolean): void;
/**
* Register the volume of the device passed in as platform accessory.
* Handles caching of accessories as well.
*
* @param client the SmartThingsClient used to send API calls
* @param device the SmartThings Device
* @param component the SmartThings Device's Component
*/
registerVolumeSlider(client: SmartThingsClient, device: Device, component: Component): void;
/**
* Validates the config and returns validation result.
* Basically checks that authentication token setup is correct.
*
* @param config the PlatformConfig
* @returns TRUE in case config is valid - FALSE otherwise
*/
private validateConfig;
}
export {};