@hernas/homebridge-panasonic-heat-pump
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -223,2 +223,8 @@ "use strict"; | ||
} | ||
if (targetTempMin === undefined || temperatureNow === undefined || targetTempMax === undefined || targetTempSet === undefined) { | ||
this.platform.log.error(`updateTargetTemperaturePropsAndReturnCurrentTemp got wrong readings: | ||
${JSON.stringify({ targetTempMin, targetTempMax, targetTempSet, temperatureNow })} | ||
`); | ||
return 100; // fake big value to indicate the issue in homekit | ||
} | ||
const tempMin = Math.floor(targetTempMin) + Math.floor(temperatureNow); | ||
@@ -225,0 +231,0 @@ const tempMax = Math.ceil(targetTempMax) + Math.ceil(temperatureNow); |
@@ -123,2 +123,5 @@ "use strict"; | ||
}); | ||
if (response3.status !== 200) { | ||
throw new Error(`Wrong response for usernamepassword/login: ${response3.status}. Most probably wrong credentials.`); | ||
} | ||
const actionUrl = (_o = response3.data.match(/action="(.+?)"/i)) === null || _o === void 0 ? void 0 : _o[1]; | ||
@@ -125,0 +128,0 @@ const inputs = (_p = response3.data.match(/<input([^\0]+?)>/ig)) !== null && _p !== void 0 ? _p : []; |
@@ -7,2 +7,3 @@ "use strict"; | ||
const types_1 = require("./types"); | ||
const parsePanasonicDetails_1 = require("./utils/parsePanasonicDetails"); | ||
class PanasonicHeatPumpHomebridgePlatform { | ||
@@ -139,100 +140,3 @@ constructor(log, config, api) { | ||
const details = await this.panasonicApi.loadDeviceDetails(deviceId); | ||
const operationalZone = details.zoneStatus.find(z => z.temparatureNow !== null); | ||
const temperatureNow = operationalZone === null || operationalZone === void 0 ? void 0 : operationalZone.temparatureNow; | ||
const isActive = details.operationStatus === 1; | ||
const direction = details.direction; | ||
const isWholeHeaterOff = details.operationStatus === 0 || operationalZone.operationStatus === 0; | ||
// What is currently being heated (so if both water tank and heater are on, what is currently being provided with heat) | ||
const isHeatingOn = direction === 1; | ||
const isTankOn = direction === 2; | ||
// if you need to return an error to show the device as "Not Responding" in the Home app: | ||
// throw new this.platform.api.hap.HapStatusError(this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE); | ||
const operationMode = details.operationMode; | ||
const heatingCoolingState = (() => { | ||
if (!isHeatingOn || isWholeHeaterOff) { | ||
return this.Characteristic.CurrentHeatingCoolingState.OFF; | ||
} | ||
if (operationMode === 1) { | ||
return this.Characteristic.CurrentHeatingCoolingState.HEAT; | ||
} | ||
if (operationMode === 2) { | ||
return this.Characteristic.CurrentHeatingCoolingState.COOL; | ||
} | ||
if (operationMode === 3) { | ||
// AUTO | ||
return this.Characteristic.CurrentHeatingCoolingState.HEAT; | ||
} | ||
if (operationMode === 4) { | ||
// AUTO | ||
return this.Characteristic.CurrentHeatingCoolingState.COOL; | ||
} | ||
return this.Characteristic.CurrentHeatingCoolingState.OFF; | ||
})(); | ||
const targetHeatingCoolingState = (() => { | ||
if (details.operationStatus === 0 || operationalZone.operationStatus === 0) { | ||
return this.Characteristic.TargetHeatingCoolingState.OFF; | ||
} | ||
switch (operationMode) { | ||
case 1: | ||
return this.Characteristic.TargetHeatingCoolingState.HEAT; | ||
case 2: | ||
return this.Characteristic.TargetHeatingCoolingState.COOL; | ||
case 3: | ||
case 4: | ||
return this.Characteristic.TargetHeatingCoolingState.AUTO; | ||
} | ||
return this.Characteristic.TargetHeatingCoolingState.OFF; | ||
})(); | ||
const ecoModeIsActive = details.specialStatus.find(s => s.specialMode === 1).operationStatus === 1; | ||
const comfortModeIsActive = details.specialStatus.find(s => s.specialMode === 2).operationStatus === 1; | ||
const outdoorTemperatureNow = details.outdoorNow; | ||
const tankTemperatureNow = details.tankStatus[0].temparatureNow; | ||
const tankTemperatureSet = details.tankStatus[0].heatSet; | ||
const tankIsActive = details.tankStatus[0].operationStatus === 1; | ||
const tankHeatingCoolingState = (() => { | ||
if (!isTankOn || !isActive || !tankIsActive) { | ||
return this.Characteristic.CurrentHeatingCoolingState.OFF; | ||
} | ||
return this.Characteristic.CurrentHeatingCoolingState.HEAT; | ||
})(); | ||
const tankTargetHeatingCoolingState = (() => { | ||
if (!tankIsActive || !isActive) { | ||
return this.Characteristic.TargetHeatingCoolingState.OFF; | ||
} | ||
return this.Characteristic.TargetHeatingCoolingState.HEAT; | ||
})(); | ||
const tempType = (() => { | ||
if (ecoModeIsActive) { | ||
return 'eco'; | ||
} | ||
if (comfortModeIsActive) { | ||
return 'comfort'; | ||
} | ||
if (operationMode === 1 || operationMode === 3) { | ||
return 'heat'; | ||
} | ||
if (operationMode === 2 || operationMode === 4) { | ||
return 'cool'; | ||
} | ||
return 'heat'; | ||
})(); | ||
return { | ||
temperatureNow, | ||
heatingCoolingState, | ||
targetHeatingCoolingState, | ||
outdoorTemperatureNow, | ||
tankTemperatureNow, | ||
tankTemperatureSet, | ||
tankHeatingCoolingState, | ||
tankTargetHeatingCoolingState, | ||
isActive, | ||
ecoModeIsActive, | ||
comfortModeIsActive, | ||
tankTemperatureMax: details.tankStatus[0].heatMax, | ||
tankTemperatureMin: details.tankStatus[0].heatMin, | ||
targetTempSet: operationalZone[`${tempType}Set`], | ||
targetTempMin: operationalZone[`${tempType}Min`], | ||
targetTempMax: operationalZone[`${tempType}Max`], | ||
tempType, | ||
}; | ||
return (0, parsePanasonicDetails_1.parsePanasonicDetails)(details, this.Characteristic); | ||
}; | ||
@@ -239,0 +143,0 @@ try { |
{ | ||
"displayName": "Homebridge Panasonic Heat Pump", | ||
"name": "@hernas/homebridge-panasonic-heat-pump", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Allows basic control of Panasonic Heat Pump (AQUAREA)", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
153148
61
1865