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

60 lines (59 loc) 2.06 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 platformSensorGeneric { readonly platform: HttpSensorsAndSwitchesHomebridgePlatform; readonly accessory: PlatformAccessory; sensorService: 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; mqttReconnectInterval: string; mqttBroker: string; mqttPort: string; mqttUsername: string; mqttPassword: string; updateInterval: number; discordWebhook: string; discordUsername: string; discordAvatar: string; discordMessage: string; paramNames: Record<string, string>; mqttTopics: Record<string, string>; SensorStates: Record<string, number>; SensorStatusRanges: 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; private getStatus; private getStateDefinition; private updateSensorStatusFromSharedData; private getSensorState; private processSensorState; private initMQTT; private initDiscordWebhooks; }