Skip to content

Commit

Permalink
fix(air conditioner): fix auto mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekkleszcz committed Mar 7, 2024
1 parent 1c8e05b commit c9a34b1
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 58 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

<p align="center">

<img src="images/logo.png" width="192">

</p>


# Homebridge Electrolux Devices

This is a plugin for connecting Electrolux devices which are controlled by the [Electrolux](https://apps.apple.com/pl/app/electrolux/id1595816832) app to Homekit.
Expand All @@ -17,8 +15,15 @@ This is a plugin for connecting Electrolux devices which are controlled by the [
3. Configure the plugin using the schema.

## 🌡️ Supported devices
- Comfort 600 air conditioner
- Well A7 air purifier
- Pure A9/AX 9 air purifier

If your device is not on the list, please create the issue. I'll be more than happy to implement the support for your device. 😄
- Comfort 600 air conditioner
- Well A7 air purifier
- Pure A9/AX 9 air purifier

If your device is not on the list, please create the issue. I'll be more than happy to implement the support for your device. 😄

## 🐛 Known issues

### Air conditioners

When air conditioner is set to Auto mode the maximum range value is set to 32, and the target temperature is set by changing minimum range value. If someone knows how to disable the temperature range in Auto mode, and allow to set the target temperature the same way as in Cool and Heat mode the PR will be more than welcome. :)
112 changes: 60 additions & 52 deletions src/accessories/devices/comfort600.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,46 +44,6 @@ export class Comfort600 extends ElectroluxAccessoryController {
this.appliance.applianceData.applianceName
);

this.service.getCharacteristic(
this.platform.Characteristic.RotationSpeed
).props.minStep = 33.33;

this.service.getCharacteristic(
this.platform.Characteristic.CoolingThresholdTemperature
).props.minValue = 16;
this.service.getCharacteristic(
this.platform.Characteristic.CoolingThresholdTemperature
).props.maxValue = 32;
this.service.getCharacteristic(
this.platform.Characteristic.CoolingThresholdTemperature
).props.minStep = 1;

this.service.getCharacteristic(
this.platform.Characteristic.HeatingThresholdTemperature
).props.minValue = 16;
this.service.getCharacteristic(
this.platform.Characteristic.HeatingThresholdTemperature
).props.maxValue = 32;
this.service.getCharacteristic(
this.platform.Characteristic.HeatingThresholdTemperature
).props.minStep = 1;

this.service.getCharacteristic(
this.platform.Characteristic.CurrentHeaterCoolerState
).props.validValues = [
this.platform.Characteristic.CurrentHeaterCoolerState.INACTIVE,
this.platform.Characteristic.CurrentHeaterCoolerState.IDLE,
this.platform.Characteristic.CurrentHeaterCoolerState.COOLING,
this.platform.Characteristic.CurrentHeaterCoolerState.HEATING
];
this.service.getCharacteristic(
this.platform.Characteristic.TargetHeaterCoolerState
).props.validValues = [
this.platform.Characteristic.TargetHeaterCoolerState.AUTO,
this.platform.Characteristic.TargetHeaterCoolerState.COOL,
this.platform.Characteristic.TargetHeaterCoolerState.HEAT
];

this.service
.getCharacteristic(this.platform.Characteristic.Active)
.onGet(this.getActive.bind(this))
Expand All @@ -93,12 +53,30 @@ export class Comfort600 extends ElectroluxAccessoryController {
.getCharacteristic(
this.platform.Characteristic.CurrentHeaterCoolerState
)
.setProps({
validValues: [
this.platform.Characteristic.CurrentHeaterCoolerState
.INACTIVE,
this.platform.Characteristic.CurrentHeaterCoolerState.IDLE,
this.platform.Characteristic.CurrentHeaterCoolerState
.COOLING,
this.platform.Characteristic.CurrentHeaterCoolerState
.HEATING
]
})
.onGet(this.getCurrentHeaterCoolerState.bind(this));

this.service
.getCharacteristic(
this.platform.Characteristic.TargetHeaterCoolerState
)
.setProps({
validValues: [
this.platform.Characteristic.TargetHeaterCoolerState.AUTO,
this.platform.Characteristic.TargetHeaterCoolerState.COOL,
this.platform.Characteristic.TargetHeaterCoolerState.HEAT
]
})
.onGet(this.getTargetHeaterCoolerState.bind(this))
.onSet(this.setTargetHeaterCoolerState.bind(this));

Expand All @@ -119,6 +97,11 @@ export class Comfort600 extends ElectroluxAccessoryController {

this.service
.getCharacteristic(this.platform.Characteristic.RotationSpeed)
.setProps({
minValue: 0,
maxValue: 100,
minStep: 33.33
})
.onGet(this.getRotationSpeed.bind(this))
.onSet(this.setRotationSpeed.bind(this));

Expand All @@ -131,13 +114,23 @@ export class Comfort600 extends ElectroluxAccessoryController {
.getCharacteristic(
this.platform.Characteristic.CoolingThresholdTemperature
)
.setProps({
minValue: 16,
maxValue: 32,
minStep: 1
})
.onGet(this.getCoolingThresholdTemperature.bind(this))
.onSet(this.setCoolingThresholdTemperature.bind(this));

this.service
.getCharacteristic(
this.platform.Characteristic.HeatingThresholdTemperature
)
.setProps({
minValue: 16,
maxValue: 32,
minStep: 1
})
.onGet(this.getHeatingThresholdTemperature.bind(this))
.onSet(this.setHeatingThresholdTemperature.bind(this));
}
Expand Down Expand Up @@ -278,7 +271,7 @@ export class Comfort600 extends ElectroluxAccessoryController {
this.service.updateCharacteristic(
this.platform.Characteristic
.CoolingThresholdTemperature,
this.appliance.properties.reported.targetTemperatureC
32
);
this.service.updateCharacteristic(
this.platform.Characteristic
Expand Down Expand Up @@ -452,6 +445,12 @@ export class Comfort600 extends ElectroluxAccessoryController {
);
}

if (this.appliance.properties.reported.mode === 'auto') {
throw new this.platform.api.hap.HapStatusError(
this.platform.api.hap.HAPStatus.INVALID_VALUE_IN_REQUEST
);
}

try {
await this.setTemperature(value);
this.appliance.properties.reported.targetTemperatureC =
Expand Down Expand Up @@ -493,7 +492,6 @@ export class Comfort600 extends ElectroluxAccessoryController {

update(appliance: Appliance) {
this.appliance = appliance;

let currentState: CharacteristicValue, targetState: CharacteristicValue;
switch (this.appliance.properties.reported.mode) {
case 'cool':
Expand Down Expand Up @@ -522,7 +520,6 @@ export class Comfort600 extends ElectroluxAccessoryController {
this.platform.Characteristic.TargetHeaterCoolerState.AUTO;
break;
}

let rotationSpeed: number;
switch (this.appliance.properties.reported.fanSpeedSetting) {
case 'auto':
Expand All @@ -538,7 +535,6 @@ export class Comfort600 extends ElectroluxAccessoryController {
rotationSpeed = 100;
break;
}

this.service.updateCharacteristic(
this.platform.Characteristic.Active,
this.appliance.properties.reported.applianceState === 'running'
Expand Down Expand Up @@ -575,13 +571,25 @@ export class Comfort600 extends ElectroluxAccessoryController {
? this.platform.Characteristic.SwingMode.SWING_ENABLED
: this.platform.Characteristic.SwingMode.SWING_DISABLED
);
this.service.updateCharacteristic(
this.platform.Characteristic.CoolingThresholdTemperature,
this.appliance.properties.reported.targetTemperatureC
);
this.service.updateCharacteristic(
this.platform.Characteristic.HeatingThresholdTemperature,
this.appliance.properties.reported.targetTemperatureC
);

if (this.appliance.properties.reported.mode === 'auto') {
this.service.updateCharacteristic(
this.platform.Characteristic.CoolingThresholdTemperature,
32
);
this.service.updateCharacteristic(
this.platform.Characteristic.HeatingThresholdTemperature,
this.appliance.properties.reported.targetTemperatureC
);
} else {
this.service.updateCharacteristic(
this.platform.Characteristic.CoolingThresholdTemperature,
this.appliance.properties.reported.targetTemperatureC
);
this.service.updateCharacteristic(
this.platform.Characteristic.HeatingThresholdTemperature,
this.appliance.properties.reported.targetTemperatureC
);
}
}
}

0 comments on commit c9a34b1

Please sign in to comment.