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.

198 lines (197 loc) 6.42 kB
import { PlatformAccessory, Logger } from 'homebridge'; import { SmartThingsPlatform } from './smartThingsPlatform.js'; import { SmartThingsClient, Device, Component } from '@smartthings/core-sdk'; import { SmartThingsAccessory } from './smartThingsAccessory.js'; /** * Class implements a SmartThings TV accessory. */ export declare class TvAccessory extends SmartThingsAccessory { private readonly logCapabilities; private readonly registerApplications; private readonly validateApplications; private readonly pollingInterval; private readonly cyclicCallsLogging; private readonly macAddress; private readonly ipAddress; private readonly inputSources; private readonly applications; private readonly informationKey; private service; private speakerService; private inputSourceServices; private capabilities; private activeIdentifierChangeTime; private activeIdentifierChangeValue; constructor(name: string, device: Device, component: Component, client: SmartThingsClient, log: Logger, platform: SmartThingsPlatform, accessory: PlatformAccessory, logCapabilities: boolean, registerApplications: boolean, validateApplications: boolean, pollingInterval: number | undefined, cyclicCallsLogging: boolean, macAddress?: string | undefined, ipAddress?: string | undefined, inputSources?: { name: string; id: string; }[] | undefined, applications?: { name: string; ids: string[]; }[] | undefined, informationKey?: string | undefined); /** * Registers all available capabilities of the SmartThings Component. */ registerCapabilities(): Promise<void>; /** * Returns all available picture modes for the current device. * * @returns the available picture modes or undefined */ getPictureModes(): Promise<{ capability: string; command: string; prefix: string; values: { id: string; name: string; value: string; }[]; } | undefined>; /** * Returns all available sound modes for the current device. * * @returns the available sound modes or undefined */ getSoundModes(): Promise<{ capability: string; command: string; prefix: string; values: { id: string; name: string; value: string; }[]; } | undefined>; /** * Returns all available input sources for the current device. * * @returns the available input sources */ getInputSources(): Promise<{ capability: string; command: string; prefix: string; values: { id: string; name: string; value: string; }[]; }>; /** * Returns whether the speaker service is available. * * @returns TRUE in case speaker service is available - FALSE otherwise */ hasSpeakerService(): boolean; /** * Registers the SmartThings Capablity if it's functionality is implemented. * * @param capability the Capability */ private registerCapability; /** * Setter for Homebridge accessory Active property. * * @param value the CharacteristicValue */ private setActive; /** * Getter for Homebridge accessory Active property. * * @param log flag to turn logging on/off * @returns the CharacteristicValue */ private getActive; /** * Setter for Homebridge accessory VolumeSelector property. * * @param value the CharacteristicValue */ private setVolumeSelector; /** * Setter for Homebridge accessory Volume property. * * @param value the CharacteristicValue */ private setVolume; /** * Getter for Homebridge accessory Volume property. * * @param log flag to turn logging on/off * @returns the CharacteristicValue */ private getVolume; /** * Setter for Homebridge accessory Mute property. * * @param value the CharacteristicValue */ private setMute; /** * Getter for Homebridge accessory Mute property. * * @param log flag to turn logging on/off * @returns the CharacteristicValue */ private getMute; /** * Setter for Homebridge accessory ActiveIdentifier property. * * @param value the CharacteristicValue */ private setActiveIdentifier; /** * Getter for Homebridge accessory ActiveIdentifier property. * * @param log flag to turn logging on/off * @returns the CharacteristicValue */ private getActiveIdentifier; /** * Setter for Homebridge accessory RemoteKey property. * * @param value the CharacteristicValue */ private setRemoteKey; /** * Validates that the SmartThings Capability needed to execute the remote key is available. * * @param capabilityId the identifier of the SmartThings Capablity * @param remoteKey the remote key * @returns TRUE in case capability is available - FALSE otherwise */ private validateRemoteKeyCapability; /** * Registers all available media input sources (e.g. HDMI inputs). */ private registerAvailableMediaInputSources; /** * Registers all applications passed in. */ private registerLaunchApplications; /** * Returns all installed applications. * * Tests a list of known application ids by trying to open them. If opening succeeded the application will be added * to returned list. If it fails the application will not be added. If multiple ids for an application are available * the first successfully tested id will be used. */ private getAvailableLaunchApplications; /** * Registers a Homebridge input source. * * @param id the input source id * @param name the input source display name * @param inputSource the InputSourceType or @code undefined @endcode to use @link guessInputSourceType @endlink * to determine InputSourceType */ private registerInputSource; /** * Guesses the InputSourceType from the identifier of the input source. * * @param inputSourceId the identifier of the input source * @returns the InputSourceType (HDMI|TUNER|OTHER) */ private guessInputSourceType; }