UNPKG

homebridge-tasmota

Version:

Homebridge plugin for Tasmota devices leveraging home assistant auto discovery.

50 lines (49 loc) 2.62 kB
import { CharacteristicSetCallback, CharacteristicValue, PlatformAccessory } from 'homebridge'; import { TasmotaService } from './TasmotaService.js'; import { tasmotaPlatform } from './tasmotaPlatform.js'; /** * Platform Accessory * An instance of this class is created for each accessory your platform registers * Each accessory may expose multiple services of different service types. */ export declare class tasmotaGarageService extends TasmotaService { readonly platform: tasmotaPlatform; readonly accessory: PlatformAccessory; protected readonly uniq_id: string; private doorStatusTopic; private doorSensorTopic; constructor(platform: tasmotaPlatform, accessory: PlatformAccessory, uniq_id: string); /** enableStatus() { this.refresh(); if (this.characteristic) { if (this.accessory.context.device[this.uniq_id].stat_t) { this.platform.log.debug('Creating statusUpdate listener for %s %s', this.accessory.context.device[this.uniq_id].stat_t, this.accessory.context.device[this.uniq_id].name); this.statusSubscribe = { event: this.accessory.context.device[this.uniq_id].stat_t, callback: this.statusUpdate.bind(this) }; this.platform.mqttHost.on(this.accessory.context.device[this.uniq_id].stat_t, this.statusUpdate.bind(this)); this.platform.mqttHost.statusSubscribe(this.accessory.context.device[this.uniq_id].stat_t); } if (this.accessory.context.device[this.uniq_id].avty_t) { this.availabilitySubscribe = { event: this.accessory.context.device[this.uniq_id].avty_t, callback: this.availabilityUpdate.bind(this) }; this.platform.mqttHost.on(this.accessory.context.device[this.uniq_id].avty_t, this.availabilityUpdate.bind(this)); this.availabilitySubscribe = this.platform.mqttHost.availabilitySubscribe(this.accessory.context.device[this.uniq_id].avty_t); } else { this.platform.log.warn('Warning: Availability not supported for: %s', this.accessory.context.device[this.uniq_id].name); } } } */ /** * Handle "STATE" messages from Tasmotastat_t: * These are sent when the device's state is changed, either via HomeKit, Local Control or Other control methods. */ statusUpdate(topic: string, message: Buffer): void; /** * Handle "SET" requests from HomeKit * These are sent when the user changes the state of an accessory, for example, turning on a Light bulb. */ setDoorState(value: CharacteristicValue, callback: CharacteristicSetCallback): void; }