UNPKG

homebridge-eightsleepthermostat

Version:

Homebridge thermostat accessory for the Eight Sleep Pod smart bed.

65 lines 2.72 kB
import { Logger } from 'homebridge'; export declare class PlatformClientAdapter { readonly sharedDeviceId: string; private readonly log; private devicesEndpoint; private sharedDeviceSettings; private lastActive; private refreshInterval?; constructor(sharedDeviceId: string, log: Logger); private loadSharedDeviceState; private refreshState; private startRefreshing; /** * When `GET` CurrentTemp handler fired, update last active timestamp. * Continuing refreshing state every 15 seconds while active, but once * handler hasn't been fired in more than 1.5 minutes, cancel the refresh * interval... i.e. we only continue hitting the client API while a home * controller is actively requesting an updated current temperature, * otherwise go into standby to prevent unnecessary requests */ private clearRefreshIfNotActive; private setAsActive; getCurrentLevel(side: 'solo' | 'left' | 'right'): Promise<number>; loadMostRecentSettings(side: 'solo' | 'left' | 'right'): Promise<number>; private determineLevelFor; private getSoloLevel; } export declare class AccessoryClientAdapter { readonly accessoryUserId: string; private readonly log; private usersEndpoint; private currentUserSettings; private lastActive; private refreshInterval?; constructor(accessoryUserId: string, log: Logger); private fetchCurrentSettings; getUserTargetLevel(): Promise<number>; getAccessoryIsOn(): Promise<boolean>; loadMostRecentSettings(): Promise<number[]>; /** * `PUT` methods below to alter client device state after local changes. * - Each of these methods returns a full response object `UserSettings` * - Rather than making a `PUT` followed by a `GET`, we update the stored * `currentUserSettings` Promise with each client `PUT` response */ updateUserTargetLevel(newLevel: number): Promise<number>; /** * Since client returns 'smart:bedtime', 'smart:initial', or 'smart:final' * depending on when the request is made, it makes checking if response * is === `BedState.on` complicated (`on` enum value is just 'smart'). * Easier to ensure not 'off' instead of checking if some 'smart:...' */ turnOnAccessory(): Promise<boolean>; turnOffAccessory(): Promise<boolean>; private updateCurrentSettingsFrom; private setAccessoryAsActive; /** * Refresh interval to continue updating state for accessory * while there is Homekit controller actvity */ private refreshState; private startRefreshing; private clearRefreshIfNotActive; } //# sourceMappingURL=clientAdapter.d.ts.map