homebridge-panasonic-ac-platform / homebridge-panasonic-ac-platform

Homebridge platform plugin providing HomeKit support for Panasonic Comfort Cloud devices
Apache License 2.0
48 stars 5 forks source link

Quiet and Powerful Mode #28

Closed mkz212 closed 1 year ago

mkz212 commented 2 years ago

Hi.

Please provide support for Quiet and Powerful mode. So that after selecting 1 rotation speed level there would be Quiet mode, and after selecting 5 rotation speed it would be Powerful mode. This may be an option to enable in the settings.

It is relatively easy. In indoor-unit.js:

/// Rotation Speed (optional)
if (deviceStatus.ecoMode === 2) {this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed).updateValue(1);}
else if (deviceStatus.ecoMode === 1) {this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed).updateValue(5);}
else if (deviceStatus.fanSpeed === 0) {this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed).updateValue(6);} 
else {
   this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed)
   .updateValue(deviceStatus.fanSpeed);
}

and

async setRotationSpeed(value) {
        this.platform.log.debug(`Accessory: setRotationSpeed() for device '${this.accessory.displayName}'`);
        if (value === 6) {
            value = 0;
        }

        var ecoMode = 0;
        if (value == 1) {ecoMode = 2}
    else if (value == 5) {ecoMode = 1}

        const parameters = {
            fanSpeed: value,
            ecoMode: ecoMode,
        };
        this.sendDeviceUpdate(this.accessory.context.device.deviceGuid, parameters);
}

and in typse.ts add ecoMode in export interface ComfortCloudDeviceUpdatePayload and export interface ComfortCloudDeviceStatus

Regards, Michal

embee8 commented 2 years ago

I like the idea of using the lowest and highest value as "insertion points" for the quiet and powerful modes.

However, this is merely a workaround for the lack of a quiet and powerful mode in Homebridge's Heat Cooler service type, and there might be users who want to utilise the lowest and highest fan speed without switching the device into a different mode. The implementation should therefore include an option that lets users decide how they want to run it.

mkz212 commented 2 years ago

As I say - this may be an option to enable in settings. So if user decide that want quiet and powerful mode, specific part of code will be enabled.

embee8 commented 2 years ago

I'll put this onto the feature request backlog and get back to it when I have some time available.

mkz212 commented 2 years ago

That's all I ask. Thank You.

embee8 commented 2 years ago

The suggestion above is semantically so correct that I'd say we can have it replace the current behaviour. This would give us the following mapping:

HomeKit Fan Speed Panasonic Setting
0 Quiet Mode
1 1
2 2
3 3
4 4
5 5
6 Powerful Mode

Does this look good to you? By the way, the plugin has currently a fan speed range of 6, but Panasonic ACs only have 5 speeds. I'm not sure why - will have to figure it out (this project contains core logic from Cody's plugin).

Also, I was wondering how we could implement the Auto mode. We could place it at the end of the range, but that makes less semantic sense and should probably be a non-default setting to avoid confusion.

mkz212 commented 2 years ago

In homekit 0 will disable AC so in code there is some line to prevent this. 0 and 6 is auto mode in Codys plugin.

This is my config: 0 - auto mode 1 - quiet mode. 2 - speed 2 3 - speed 3 4 - speed 4 5 - powerful mode 6 - auto mode

In my first post I wrote what and where to change in Your code to have quiet and powerful mode. 🙂

embee8 commented 2 years ago

Thanks! Why is the auto mode mapped twice in your setup?

Also, I checked the Panasonic app and it looks like it offers 5 different fan speeds, plus quiet and powerful mode, which brings us to 7. Adding the auto mode would get us to 8 (which would map to 0-7).

mkz212 commented 2 years ago

If You set 0 rotation speed in home app it turns off device (in this case AC). So in Cody's plugin there is part of code to prevent this. Something like: if set 0 than set 6 (so 0 and 6 are connected). Really available values are 1 to 5.

Yes I know that in Panasonic app we have 5 rotation speeds and 2 special modes and auto mode (8 values), but who really need 8? Quiet mode is very similar to rotation speed 1, but better. Powerful mode is very similar to rotation speed 5, but better. So in my opinion rotation speed 1 and 5 are unnecessary.

embee8 commented 2 years ago

Note taken on your last point. Although I'll have a think about how we could make this customisable in case people want to access the full range.

If You set 0 rotation speed in home app it turns off device (in this case AC). So in Cody's plugin there is part of code to prevent this. Something like: if set 0 than set 6 (so 0 and 6 are connected). Really available values are 1 to 5.

Have a look at this line, which maps the value 6 (from the Home app) to a fan speed (on the Panasonic side) of 0. I cannot find the remapping of 0 to 6 as mentioned above.

I'll test this again and see how the system reacts for each currently available fan speed.

mkz212 commented 2 years ago

From line 246 there is part of code You are looking for (that makes 6 rotation speed from 0).

If You want to make this as an option, that people can change in settings to use Quiet Mode and Powerful Mode or not, simply make something like:

if (special options enabled) {
new code that i wrote in first post
}
else {
old code (that is now)
}
mstendah commented 2 years ago

Hi, what was the outcome of this i.e. what is the current functionality in the plugin and what setting should I have in this setting in Homekit in order to run the unit in Auto Fan mode?

image

mkz212 commented 2 years ago

Rotation speed 6.

mstendah commented 2 years ago

Rotation speed 6.

How do I set that in Apple Homekit? Pull the "Fan speed" slider all the way to the far right as in the picture?

mkz212 commented 2 years ago

Yes

embee8 commented 2 years ago

To keep you in the loop: Revamping the rotation speeds and including the quiet and powerful modes is on the roadmap.

mstendah commented 2 years ago

👍

mkz212 commented 2 years ago

👍

mkz212 commented 1 year ago

Hi. Any progress? When can we expect Quiet and Powerful mode?

mkz212 commented 1 year ago

Hi. I have an even better solution.

Homekit Rotation speed - Panasonic Comfort Cloud rotation speed or special mode 0 - off 1 - quiet mode 2 - 1 speed 3 - 2 speed 4 - 3 speed 5 - powerful mode 6 - auto

As you can see, there are no 4 and 5 speeds with Panasonic Comfort Cloud here, because in homekit we only have 6 values ​​available (0 will always disable AC). Personally I think that if there must be high speed then should be Powerful mode.

CODE:

in dist/accessories/indoor-unit.js, you should swap:

/// Rotation Speed (optional)
            if (deviceStatus.ecoMode === 2) {this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed).updateValue(1);}
            else if (deviceStatus.ecoMode === 1) {this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed).updateValue(5);}
            else if (deviceStatus.fanSpeed === 0) {this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed).updateValue(6);}
            else if (deviceStatus.fanSpeed === 1) {this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed).updateValue(2);}
            else if (deviceStatus.fanSpeed === 2) {this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed).updateValue(3);}
            else if (deviceStatus.fanSpeed === 3) {this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed).updateValue(4);}
            else if (deviceStatus.fanSpeed === 4) {this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed).updateValue(4);} 
            else if (deviceStatus.fanSpeed === 5) {this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed).updateValue(4);}  
            else {
               this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed)
               .updateValue(deviceStatus.fanSpeed);
            }

and

async setRotationSpeed(value) {
        this.platform.log.debug(`Accessory: setRotationSpeed() for device '${this.accessory.displayName}'`);

        var ecoMode = 0;

        if (value === 1) {
            ecoMode = 2
        }

        if (value === 2) {
            value = 1;
        }

        if (value === 3) {
            value = 2;
        }

        if (value === 4) {
            value = 3;
        }

        if (value === 5) {
            ecoMode = 1
        }

        if (value === 6) {
            value = 0;
        }

        const parameters = {
            fanSpeed: value,
            ecoMode: ecoMode,
        };
        this.sendDeviceUpdate(this.accessory.context.device.deviceGuid, parameters);
      }

and in src/types.ts in „export interface ComfortCloudDeviceUpdatePayload” and in „export interface ComfortCloudDeviceStatus” add:

ecoMode?: number;

That's all.

Mani1082 commented 1 year ago

That would be awsome to have those features 👍🏼

Sebillas commented 1 year ago

Waiting to see those features in HomeKit.😄

mkz212 commented 1 year ago

@embee8 any news when we can expect Quiet and Powerful mode?

embee8 commented 1 year ago

Code is ready for review in the linked pull request.

mkz212 commented 1 year ago

Looks great! 👍

embee8 commented 1 year ago

I just published this feature as part of the v1.5.0 release.

The mapping between slider position and Comfort Cloud setting can be found in the README. You probably have to delete your cached accessories to make sure the updated slider range is configured correctly.

Thanks everyone for your contributions to the discussion, especially @mkz212 for his code pointers.

mkz212 commented 1 year ago

I'm glad I could help 👍🙂