homebridge-fenix-tft-wifi
Version:
Homebridge plugin which adds a Fenix TFT WiFi thermostat as HomeKit device.
61 lines • 1.96 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ThermostatMode_1 = require("../Enum/ThermostatMode");
class ThermostatData {
constructor(data) {
this.data = data;
}
get targetHeatingCoolingState() {
if (this.mode === ThermostatMode_1.ThermostatMode.OFF) {
return 0;
}
if (this.mode === ThermostatMode_1.ThermostatMode.ANTIFREEZE) {
return 2;
}
if (this.mode === ThermostatMode_1.ThermostatMode.AUTO) {
return 3;
}
return 1;
}
get currentHeatingCoolingState() {
if (this.mode === ThermostatMode_1.ThermostatMode.OFF || this.actualTemperature >= this.requiredTemperature) {
return 0;
}
return 1;
}
get mode() {
if (this.data.Dm.value === ThermostatMode_1.ThermostatMode.OFF) {
return ThermostatMode_1.ThermostatMode.OFF;
}
if (this.data.Dm.value === ThermostatMode_1.ThermostatMode.AUTO) {
return ThermostatMode_1.ThermostatMode.AUTO;
}
if (this.data.Dm.value === ThermostatMode_1.ThermostatMode.ANTIFREEZE) {
return ThermostatMode_1.ThermostatMode.ANTIFREEZE;
}
return ThermostatMode_1.ThermostatMode.MANUAL;
}
set mode(mode) {
this.data.Dm.value = mode;
}
get actualTemperature() {
return this.data.At.value / this.data.At.divFactor;
}
get requiredTemperature() {
return this.data.Ma.value / this.data.Ma.divFactor;
}
set requiredTemperature(temperature) {
this.data.Ma.value = temperature * this.data.Ma.divFactor;
}
get realRequiredTemperature() {
return this.data.Ma.value;
}
get model() {
return this.data.Ty.value;
}
get softwareVersion() {
return this.data.Sv.value;
}
}
exports.default = ThermostatData;
//# sourceMappingURL=ThermostatData.js.map