UNPKG

homebridge-eightsleepthermostat

Version:

Homebridge thermostat accessory for the Eight Sleep Pod smart bed.

71 lines 2.76 kB
import { PlatformAccessory, CharacteristicValue } from 'homebridge'; import { EightSleepThermostatPlatform } from './platform'; import { PlatformClientAdapter } from './clientAdapter'; export declare class EightSleepThermostatAccessory { private readonly platform; private readonly accessory; private readonly platformClient; private service; private readonly log; private minStep; private minTempC; private maxTempC; private temperatureDisplayUnits; private tempMapper; private userIdForSide; private deviceSide; private accessoryClient; private lastActive; private refreshInterval?; constructor(platform: EightSleepThermostatPlatform, accessory: PlatformAccessory, platformClient: PlatformClientAdapter); private setPluginAsActive; private startRefreshing; private refreshState; private clearRefreshIfNotActive; private publishLatestChanges; /** * Gets the *measured* current temperature of each side of bed from * client API. This metric is returned from client for both sides * of bed from the same endpoint. In order to prevent multiple * unecessary requests to the same endpoint for each side of bed, * we query API once and parse the data using the 'side' property */ private fetchCurrentTemp; private fetchTargetState; private fetchTargetTemp; private fetchCurrentState; private characteristicValueForCurrentState; private updateCurrentHCState; private updateTargetTemperature; private updateDeviceState; /** * Current Temperature & State Handlers */ handleCurrentHeatingCoolingStateGet(): Promise<1 | 0 | 2>; handleCurrentTemperatureGet(): Promise<number>; /** * Target Temperature Handlers */ handleTargetTemperatureGet(): Promise<number>; handleTargetTemperatureSet(value: CharacteristicValue): Promise<void>; /** * Target State Handlers */ handleTargetHeatingCoolingStateGet(): Promise<0 | 3>; handleTargetHeatingCoolingStateSet(value: CharacteristicValue): Promise<void>; /** * Temperature Display Units Handlers */ handleTemperatureDisplayUnitsGet(): Promise<number>; handleTemperatureDisplayUnitsSet(value: CharacteristicValue): Promise<void>; /** * Adjust equality comparison to account for the `minStep` property * of 0.5 on Target temp. Ensures that display temps are actually * equal when determining the current state. If target state is set * to `on` (`Auto`, `Cool`, `Heat`), then current state will display * `Idle` in home status when temps are equal. */ private tempsAreEqual; private verifyInSyncTemps; } //# sourceMappingURL=platformAccessory.d.ts.map