/**
* Handle requests to get the current value of the "RotationSpeed" characteristic
*/
handleDehumidifierRotationSpeedGet(callback) {
this.platform.log.debug('Triggered GET RotationSpeed');
// values from device are 20.0="Homekit off", 40.0="Silent",60.0="Medium",80.0="High"
callback(null, this.fanSpeed);
}
/**
* Handle requests to set the "RotationSpeed" characteristic for Dehumidifier
*/
handleDehumidifierRotationSpeedSet(value, callback) {
this.platform.log.debug('Triggered SET RotationSpeed:', value);
if (this.fanSpeed != value) {
// values from device are 20.0="Homekit off", 40.0="Silent",60.0="Medium",80.0="High"
this.fanSpeed = value;
this.platform.sendUpdateToDevice(this);
}
callback(null, value);
}
It's nice of you to look at the code I wrote and tell me what to do.
The lines of code are already ready and there is no need to fix them.
You just had to ask.
I publish version 1.3.4
I have a Midea dehumidifier, and it has a fan speed to be controlled, I'm attaching some code to ease the implementation:
This line: https://github.com/hillaliy/homebridge-midea-air/blob/7e5556b34aed9385578261a11073b0164e6f0371/src/MideaAccessory.ts#L237 Should be replaced by:
And the handlers are:
sendUpdateToDevice command should be modified to send the fanSpeed to the device: https://github.com/hillaliy/homebridge-midea-air/blob/7e5556b34aed9385578261a11073b0164e6f0371/src/MideaPlatform.ts#L370
And last, this line should refresh fanSpeed HK property https://github.com/hillaliy/homebridge-midea-air/blob/7e5556b34aed9385578261a11073b0164e6f0371/src/MideaAccessory.ts#L254