Skip to content

Commit

Permalink
release v3.3.16, fix #167
Browse files Browse the repository at this point in the history
  • Loading branch information
grzegorz914 committed Sep 23, 2024
1 parent eb5c6a2 commit 257b811
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 152 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- do not configure it manually, always using Config UI X
- required Homebridge v2.0.0 and above

## [3.3.15] - (21.09.2024)
## [3.3.16] - (23.09.2024)

## Changes

- fix report wrong target mode if device is OFF and the plugin or bridge reboots
- fix [#167](https://github.com/grzegorz914/homebridge-melcloud-control/issues/167)
- cleanup

## [3.3.15] - (21.09.2024)

## Changes

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"displayName": "MELCloud Control",
"name": "homebridge-melcloud-control",
"version": "3.3.15",
"version": "3.3.16",
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
"license": "MIT",
"author": "grzegorz914",
Expand Down
171 changes: 72 additions & 99 deletions src/deviceata.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ class DeviceAta extends EventEmitter {

//accessory
this.accessory = {};
this.accessory.currentOperationMode = 0;
this.accessory.targetOperationMode = 0;
this.accessory.fanSpeed = 0;
this.accessory.useFahrenheit = useFahrenheit ? 1 : 0;
this.accessory.temperatureUnit = CONSTANTS.TemperatureDisplayUnits[this.accessory.useFahrenheit];
};
Expand Down Expand Up @@ -293,64 +290,51 @@ class DeviceAta extends EventEmitter {
switch (this.displayMode) {
case 1: //Heater Cooler
//operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
switch (power) {
case true:
switch (!inStandbyMode) {
case true:
switch (operationMode) {
case 1: //HEAT
this.accessory.currentOperationMode = roomTemperature > setTemperature ? 1 : 2; //INACTIVE, IDLE, HEATING, COOLING
this.accessory.targetOperationMode = 1; //AUTO, HEAT, COOL
break;
case 2: //DRY
this.accessory.currentOperationMode = 1;
this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
break;
case 3: //COOL
this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
this.accessory.targetOperationMode = 2;
break;
case 7: //FAN
this.accessory.currentOperationMode = 1;
this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 0 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
break;
case 8: //AUTO
this.accessory.currentOperationMode = roomTemperature < setTemperature ? 2 : roomTemperature > setTemperature ? 3 : 1;
this.accessory.targetOperationMode = 0;
break;
case 9: //ISEE HEAT
this.accessory.currentOperationMode = roomTemperature > setTemperature ? 1 : 2
this.accessory.targetOperationMode = 1;
break;
case 10: //ISEE DRY
this.accessory.currentOperationMode = 1;
this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
break;
case 11: //ISEE COOL;
this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
this.accessory.targetOperationMode = 2;
break;
default:
this.emit('warn', `Received unknown operating mode: ${operationMode}`);
return
};
break;
case false:
this.accessory.currentOperationMode = 1;
break;
};
switch (operationMode) {
case 1: //HEAT
this.accessory.currentOperationMode = roomTemperature > setTemperature ? 1 : 2; //INACTIVE, IDLE, HEATING, COOLING
this.accessory.targetOperationMode = 1; //AUTO, HEAT, COOL
break;
case false:
this.accessory.currentOperationMode = 0;
case 2: //DRY
this.accessory.currentOperationMode = 1;
this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
break;
case 3: //COOL
this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
this.accessory.targetOperationMode = 2;
break;
case 7: //FAN
this.accessory.currentOperationMode = 1;
this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 0 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
break;
case 8: //AUTO
this.accessory.currentOperationMode = roomTemperature < setTemperature ? 2 : roomTemperature > setTemperature ? 3 : 1;
this.accessory.targetOperationMode = 0;
break;
case 9: //ISEE HEAT
this.accessory.currentOperationMode = roomTemperature > setTemperature ? 1 : 2
this.accessory.targetOperationMode = 1;
break;
case 10: //ISEE DRY
this.accessory.currentOperationMode = 1;
this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
break;
case 11: //ISEE COOL;
this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
this.accessory.targetOperationMode = 2;
break;
default:
this.emit('warn', `Received unknown operating mode: ${operationMode}`);
return
};

this.accessory.currentOperationMode = !power ? 0 : inStandbyMode ? 1 : this.accessory.currentOperationMode;
this.accessory.operationModeSetPropsMinValue = modelSupportsAuto && modelSupportsHeat ? 0 : !modelSupportsAuto && modelSupportsHeat ? 1 : modelSupportsAuto && !modelSupportsHeat ? 0 : 2;
this.accessory.operationModeSetPropsMaxValue = 2
this.accessory.operationModeSetPropsValidValues = modelSupportsAuto && modelSupportsHeat ? [0, 1, 2] : !modelSupportsAuto && modelSupportsHeat ? [1, 2] : modelSupportsAuto && !modelSupportsHeat ? [0, 2] : [2];

//fan speed mode
if (modelSupportsFanSpeed) {
this.accessory.fanSpeedSetPropsMaxValue = 2;
switch (numberOfFanSpeeds) {
case 2: //Fan speed mode 2
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [3, 1, 2][fanSpeed] : [0, 1, 2][fanSpeed];
Expand Down Expand Up @@ -391,56 +375,45 @@ class DeviceAta extends EventEmitter {
};
break;
case 2: //Thermostat
switch (power) {
case true:
switch (!inStandbyMode) {
case true:
switch (operationMode) {
case 1: //HEAT
this.accessory.currentOperationMode = roomTemperature > setTemperature ? 0 : 1; //OFF, HEATING, COOLING
this.accessory.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
break;
case 2: //DRY
this.accessory.currentOperationMode = 0;
this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
break;
case 3: //COOL
this.accessory.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
this.accessory.targetOperationMode = 2;
break;
case 7: //FAN
this.accessory.currentOperationMode = 0;
this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 3 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
break;
case 8: //AUTO
this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : roomTemperature > setTemperature ? 2 : 0;
this.accessory.targetOperationMode = 3;
break;
case 9: //ISEE HEAT
this.accessory.currentOperationMode = roomTemperature > setTemperature ? 0 : 1;
this.accessory.targetOperationMode = 1;
break;
case 10: //ISEE DRY
this.accessory.currentOperationMode = 0;
this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
break;
case 11: //ISEE COOL;
this.accessory.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
this.accessory.targetOperationMode = 2;
break;
default:
this.emit('warn', `Unknown operating mode: ${operationMode}`);
break;
};
break;
case false:
this.accessory.currentOperationMode = 0;
break;
};
case false:
switch (operationMode) {
case 1: //HEAT
this.accessory.currentOperationMode = roomTemperature > setTemperature ? 0 : 1; //OFF, HEATING, COOLING
this.accessory.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
break;
case 2: //DRY
this.accessory.currentOperationMode = 0;
this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
break;
case 3: //COOL
this.accessory.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
this.accessory.targetOperationMode = 2;
break;
case 7: //FAN
this.accessory.currentOperationMode = 0;
this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 3 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
break;
case 8: //AUTO
this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : roomTemperature > setTemperature ? 2 : 0;
this.accessory.targetOperationMode = 3;
break;
case 9: //ISEE HEAT
this.accessory.currentOperationMode = roomTemperature > setTemperature ? 0 : 1;
this.accessory.targetOperationMode = 1;
break;
case 10: //ISEE DRY
this.accessory.currentOperationMode = 0;
this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
break;
case 11: //ISEE COOL;
this.accessory.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
this.accessory.targetOperationMode = 2;
break;
default:
this.emit('warn', `Unknown operating mode: ${operationMode}`);
break;
};

this.accessory.currentOperationMode = !power ? 0 : inStandbyMode ? 0 : this.accessory.currentOperationMode;
this.accessory.operationModeSetPropsMinValue = 0
this.accessory.operationModeSetPropsMaxValue = modelSupportsAuto && modelSupportsHeat ? 3 : !modelSupportsAuto && modelSupportsHeat ? 2 : modelSupportsAuto && !modelSupportsHeat ? 3 : 2;
this.accessory.operationModeSetPropsValidValues = modelSupportsAuto && modelSupportsHeat ? [0, 1, 2, 3] : !modelSupportsAuto && modelSupportsHeat ? [0, 1, 2] : modelSupportsAuto && !modelSupportsHeat ? [0, 2, 3] : [0, 2];
Expand Down
Loading

0 comments on commit 257b811

Please sign in to comment.