UNPKG

@homebridge-plugins/homebridge-roomba

Version:
124 lines 4.27 kB
import type { AccessoryPlugin, API, Logging, PlatformAccessory, Service } from 'homebridge'; import type RoombaPlatform from './platform.js'; import type { Robot } from './roomba.js'; import type { DeviceConfig, RoombaPlatformConfig } from './settings.js'; export default class RoombaAccessory implements AccessoryPlugin { readonly platform: RoombaPlatform; private api; private log; private name; private model; private serialnum; private blid; private robotpwd; private ipaddress; private cleanBehaviour; private mission; private stopBehaviour; private debug; private idlePollIntervalMillis; private deviceInfo?; private version; private accessoryInfo; private filterMaintenance; private switchService; private batteryService; private dockService?; private runningService?; private binService?; private dockingService?; private homeService?; private tankService?; /** * The last known state from Roomba, if any. */ private cachedStatus; private lastUpdatedStatus; private lastRefreshState; /** * The current promise that returns a Roomba instance (_only_ used in the connect() method). */ private _currentRoombaPromise?; /** * Whether the plugin is actively polling Roomba's state and updating HomeKit */ private currentPollTimeout?; /** * When we think a user / HomeKit was last interested in Roomba's state. */ private userLastInterestedTimestamp?; /** * When we last saw the Roomba active. */ private roombaLastActiveTimestamp?; /** * The duration of the last poll interval used. */ private lastPollInterval?; /** * An index into `ROBOT_CIPHERS` indicating the current cipher configuration used to communicate with Roomba. */ private currentCipherIndex; constructor(platform: RoombaPlatform, accessory: PlatformAccessory, log: Logging, device: Robot & DeviceConfig, config: RoombaPlatformConfig, api: API); private serialNum; identify(): void; getServices(): Service[]; /** * Refresh our knowledge of Roomba's state by connecting to Roomba and getting its status. * @param callback a function to call when the state refresh has completed. */ private refreshState; private receivedRobotStateIsComplete; private receiveRobotState; /** * Returns a Promise that, when resolved, provides access to a connected Roomba instance. * In order to reuse connected Roomba instances, this function returns the same Promise across * multiple calls, until that Roomba instance is disconnected. * <p> * If the Promise fails it means there was a failure connecting to the Roomba instance. * @returns a RoombaHolder containing a connected Roomba instance */ private connectedRoomba; private connect; private setRunningState; private setDockingState; private dockWhenStopped; /** * Creates as a Characteristic getter function that derives the CharacteristicValue from Roomba's status. */ private createCharacteristicGetter; /** * Merge in changes to the cached status, and update our characteristics so the plugin * preemptively reports state back to Homebridge. */ private mergeCachedStatus; /** * Update the cached status and update our characteristics so the plugin preemptively * reports state back to Homebridge. */ private setCachedStatus; private parseState; private updateCharacteristics; /** * Trigger a refresh of Roomba's status for a user. */ private refreshStatusForUser; /** * Start polling Roomba's status and reporting updates to HomeKit. * We start polling whenever an event occurs, so we update HomeKit promptly * when the status changes. */ private startPolling; private currentPollInterval; private isActive; private runningStatus; private chargingStatus; private dockingStatus; private dockedStatus; private batteryLevelStatus; private binStatus; private batteryStatus; private tankStatus; private tankLevelStatus; } //# sourceMappingURL=accessory.d.ts.map