@homebridge-plugins/homebridge-smarthq
Version:
The SmartHQ plugin allows you to interact with SmartHQ Devices in HomeKit and with Siri.
40 lines • 1.25 kB
JavaScript
import { ERD_TYPES } from '../../../../index.js';
import { OpalDeviceBase } from '../../OpalDeviceBase.js';
export class OpalStatusBase extends OpalDeviceBase {
platform;
accessory;
device;
OpalStatusCodes = {
MAKING_ICE: 0,
DEFROSTING: 1,
CLEANING: 2,
ICE_BIN_FULL: 3,
ADD_WATER: 4,
ICE_BIN_MISSING: 5,
IDLE: 6,
MISSING_WATER_SOURCE: 7,
LID_OPEN: 8,
UNKNOWN: 255,
};
opalCurrentStatus = this.OpalStatusCodes.IDLE;
constructor(platform, accessory, device) {
super(platform, accessory, device);
this.platform = platform;
this.accessory = accessory;
this.device = device;
}
async getOpalCurrentStatus() {
const rawStatusResponse = await this.readErd(ERD_TYPES.OIM_STATUS);
const opalIceMakerStatus = Number.parseInt(rawStatusResponse);
this.setOpalCurrentStatus(opalIceMakerStatus);
}
async setOpalCurrentStatus(newStatus) {
this.opalCurrentStatus = newStatus;
this.setChildStatus();
}
// This will be overridden by the child class
setChildStatus() {
// Default implementation does nothing
}
}
//# sourceMappingURL=OpalStatusBase.js.map