UNPKG

@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.

51 lines (50 loc) 2.86 kB
import { Characteristic, CharacteristicValue, Logger, PlatformAccessory, Service, WithUUID } from 'homebridge'; import { SmartThingsPlatform } from './smartThingsPlatform.js'; import { SmartThingsClient, Device, Component, CapabilityStatus, Capability } from '@smartthings/core-sdk'; /** * Class implements a base class for SmartThings accessories. */ export declare abstract class SmartThingsAccessory { protected readonly device: Device; protected readonly component: Component; protected readonly client: SmartThingsClient; protected readonly platform: SmartThingsPlatform; protected readonly accessory: PlatformAccessory; private readonly log; protected constructor(device: Device, component: Component, client: SmartThingsClient, platform: SmartThingsPlatform, accessory: PlatformAccessory, log: Logger); /** * Executes the command of the capability passed in using the arguments passed in. * Handles error values returned by api. * * @param capability the capability identifier * @param command the command identifier * @param args the command arguments */ protected executeCommand(capability: string, command: string, args?: (string | number | object)[]): Promise<void>; /** * Returns the status of the capability passed in. * Handles error values returned by api. * * @param capability the capability identifier * @param log flag to turn logging on/off * @returns the capability status or undefined for errors returned by API */ protected getCapabilityStatus(capability: string, log?: boolean): Promise<CapabilityStatus | null>; /** * Starts polling the status of the capability passed in using the parameters passed in. * Must only be used on capabilities that are not updated cyclical automatically. * * @param capability the capability that will be updated * @param service the service containing the characteristic * @param characteristic the characteristic that will be updated * @param getter the function to be used to get the new value * @param interval the interval in milliseconds (if set to undefined polling will not be started) */ protected startStatusPolling<T extends WithUUID<new () => Characteristic>>(capability: string, service: Service, characteristic: T, getter: () => Promise<CharacteristicValue>, interval: number | undefined): void; protected logCapabilityRegistration(capability: Capability): void; protected logCapabilityState(capability: Capability): void; protected logInfo(message: string, ...parameters: unknown[]): void; protected logWarn(message: string, ...parameters: unknown[]): void; protected logError(message: string, ...parameters: unknown[]): void; protected logDebug(message: string, ...parameters: unknown[]): void; }