UNPKG

homebridge-http-sensors-switches

Version:

This plugin communicates with your devices over HTTP or MQTT. Currently it supports Light Bulb, Switches, Outlets, Fan, Garage Door, Shades / Blinds, Temperature/Humidity, Motion, Contact and Occupancy sensor, Door, Sprinkler, Valve, Air Quality, Smoke, C

69 lines (68 loc) 2.38 kB
import { PlatformAccessory, Service } from 'homebridge'; import type { HttpSensorsAndSwitchesHomebridgePlatform } from './platform.js'; import mqtt from 'mqtt'; /** * 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 platformGenericDevice { readonly platform: HttpSensorsAndSwitchesHomebridgePlatform; readonly accessory: PlatformAccessory; service: Service; mqttClient: mqtt.MqttClient; private sharedPollingInstance?; private isReachable; enableLogging: boolean; ignoreHttpsCertErrors: boolean; trustedCert?: string; sharedPolling: boolean; sharedPollingId: string; sharedPollingInterval: number; deviceId: string; deviceType: string; deviceName: string; deviceManufacturer: string; deviceModel: string; deviceSerialNumber: string; deviceFirmwareVersion: string; urlStatus: string; urlDeviceControl: string; methodUpdate: boolean; mqttReconnectInterval: string; mqttBroker: string; mqttPort: string; mqttUsername: string; mqttPassword: string; discordWebhook: string; discordUsername: string; discordAvatar: string; discordMessage: string; paramNames: Record<string, string>; mqttTopics: Record<string, string>; DeviceStates: Record<string, number>; DeviceStatusRanges: Record<string, [number, number]>; private httpsAgentManager; constructor(platform: HttpSensorsAndSwitchesHomebridgePlatform, accessory: PlatformAccessory); /** * Wraps the get handler for a characteristic to handle device state retrieval. * @param state The state key to retrieve. * @returns A function that handles the get request. */ private wrapGetHandler; /** * Wraps the set handler for a characteristic to handle device state updates. * @param state The state key to update. * @returns A function that handles the set request. */ private wrapSetHandler; private getStateDefinition; private getStatus; private updateDeviceStatusFromSharedData; private getDeviceState; private processGetDeviceStatusData; private setDeviceState; private initMQTT; private publishMQTTmessage; private initDiscordWebhooks; }