UNPKG

@di-zed/yandex-smart-home

Version:

The Yandex Smart Home skills for the different device types.

78 lines (77 loc) 2.2 kB
import { MqttCommandTopicInterface } from '../interfaces/mqttInterface'; import { CommandTopicData } from './mqttService'; /** * Topic Service. */ declare class TopicService { /** * The Topic Timeout IDs. * * @protected */ protected topicTimeoutIds: TopicTimeoutIds; /** * Prepare Message for the MQTT Topic. * * @param aliceValue * @param topicData * @returns Promise<string> */ convertAliceValueToMqttMessage(aliceValue: any, topicData?: CommandTopicData): Promise<string>; /** * Prepare Value for the Alice Device Capability State. * * @param mqttMessage * @param topicData * @returns Promise<any> */ convertMqttMessageToAliceValue(mqttMessage: string, topicData?: CommandTopicData): Promise<any>; /** * Set Topic Message to the Cache. * * @param topic * @param message * @returns Promise<boolean> */ setTopicMessage(topic: string, message: string): Promise<boolean>; /** * Get Topic Message from the Cache. * * @param topic * @returns Promise<string | undefined> */ getTopicMessage(topic: string): Promise<string | undefined>; /** * Get Value from the State Topic by Keys. * * @param topic * @param keys * @returns Promise<string | undefined> */ getStateTopicValueByKey(topic: string, keys: string[]): Promise<string | undefined>; /** * Get State Topic changes. * * @param oldMessage * @param newMessage * @param deviceType * @returns Promise<ChangedCommandTopicInterface[]> */ getStateTopicChanges(oldMessage: string | undefined, newMessage: string, deviceType?: string): Promise<ChangedCommandTopicInterface[]>; } /** * Changed MQTT Command Topic Interface. */ export interface ChangedCommandTopicInterface extends MqttCommandTopicInterface { deviceType: string; mqttValueOld: string | number; mqttValueNew: string | number; } /** * The "Topic => Timeout ID" Type. */ export type TopicTimeoutIds = { [key: string]: ReturnType<typeof setTimeout>; }; declare const _default: TopicService; export default _default;