homebridge-wideq
Version:
WideQ for Homebridge
68 lines (67 loc) • 3.75 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.RefrigeratorParser = void 0;
var accessory_1 = require("./accessory");
var RefrigeratorParser = /** @class */ (function (_super) {
__extends(RefrigeratorParser, _super);
function RefrigeratorParser(platform, accessoryType) {
var _this = _super.call(this, platform, accessoryType) || this;
_this.platform = platform;
_this.accessoryType = accessoryType;
return _this;
}
RefrigeratorParser.prototype.getAccessoryCategory = function (device) {
return this.platform.Accessory.Categories.OTHER;
};
RefrigeratorParser.prototype.updateAccessoryStatuses = function (device, accessory, status) {
var Characteristic = this.platform.Characteristic;
this.createOrUpdateService(accessory, 'TempRefrigerator', this.platform.Service.Thermostat, [{
characteristic: Characteristic.CurrentTemperature,
getter: function () { return status === null || status === void 0 ? void 0 : status.tempRefrigeratorC; },
options: { minValue: 1, maxValue: 7 },
}, {
characteristic: Characteristic.TargetTemperature,
setter: function (value) { return device.setTempRefrigeratorC(value); },
options: { minValue: 1, maxValue: 7 },
}]);
this.createOrUpdateService(accessory, 'TempFreezer', this.platform.Service.Thermostat, [{
characteristic: Characteristic.CurrentTemperature,
getter: function () { return status === null || status === void 0 ? void 0 : status.tempFreezerC; },
options: { minValue: -23, maxValue: -15 },
}, {
characteristic: Characteristic.TargetTemperature,
setter: function (value) { return device.setTempFreezerC(value); },
options: { minValue: -23, maxValue: -15 },
}]);
this.createOrUpdateService(accessory, 'DoorOpened', this.platform.Service.ContactSensor, [{
characteristic: Characteristic.ContactSensorState,
getter: function () { return status === null || status === void 0 ? void 0 : status.doorOpened; },
}]);
//if (device.model.value('EcoFriendly')) {
this.createOrUpdateService(accessory, 'EcoEnabled', this.platform.Service.Switch, [{
characteristic: Characteristic.On,
getter: function () { return status === null || status === void 0 ? void 0 : status.ecoEnabled; },
setter: function (value) { return device.setEcoEnabled(value); },
}]);
this.createOrUpdateService(accessory, 'IcePlusStatus', this.platform.Service.Switch, [{
characteristic: Characteristic.On,
getter: function () { return status === null || status === void 0 ? void 0 : status.icePlusStatus; },
setter: function (value) { return device.setIcePlusStatus(value); },
}]);
};
return RefrigeratorParser;
}(accessory_1.AccessoryParser));
exports.RefrigeratorParser = RefrigeratorParser;