yenoiwesa/homebridge-daikin-airbase

Fan rotation speed displaying incorrectly

Closed this issue · 14 comments

I’ve noticed an issue where the fan rotation speed incorrectly displays as 0% while the AC is turned on.

Changing the speed via the Home app fixes the issue temporarily, but it reverts to 0% when the accessory updates.

In this screenshot, the fan speed is set to Low/33.3% but displays as 0%.

88DC37D8-520B-49FE-B8CF-ED8955CED29B

Hi @jasongerbes 👋 That sounds like a bug.

Could you please restart your Homebridge server in debug mode (add -D to the command line arguments) and check for the following log line:

I would like to see the aircon/get_control_info response and the response to aircon/get_model_info. Thanks!

@yenoiwesa thanks for the quick response!

Here is the debug log entry:

Sent: http://10.11.11.19/skyfi/aircon/get_control_info With Values: undefined Response: {
  power: 1,
  mode: 2,
  targetTemperature: 20,
  modeTargetTemperature: { '1': 19, '2': 20, '3': 21 },
  fanRate: 3,
  fanAirside: 0,
  fanAuto: 0,
  fanDirection: 0
}

Could you also provide the response from aircon/get_model_info please?

Oops, here you go:

Sent: http://10.11.11.19/skyfi/aircon/get_model_info With Values: undefined Response: {
  model: 'N/A',
  type: 'N',
  isHumidifierSupported: false,
  zoneCount: 0,
  setTemperatureSupported: true,
  fanRateSupported: true,
  fanDirectionSupported: false,
  autoModeSupported: false,
  dryModeSupported: true,
  coolMinTemperature: 16,
  coolMaxTempertature: 32,
  heatMinTemperature: 16,
  heatMaxTemperature: 32,
  fanRateSteps: 3,
  autoFanRateSupported: false
}

That is surprising. I see that you have fanRateSupported set to true and three fanRateSteps from your get_model_info response, and also that power is set to 1 (on) as well as fanRate set to 3 which should evaluate as FanSpeed.MEDIUM and thus show the fan slider at 66% 🤔

In your node_modules/homebridge-daikin-airbase directory could you add a few logging lines in this function:
https://github.com/yenoiwesa/homebridge-daikin-airbase/blob/master/src/services/fan.js#L88-L113

If you, for instance, do something like:

    async getRotationSpeed(controlInfo = null) {
        const { power, fanRate } =
            controlInfo || (await this.airbase.getControlInfo());

       this.log.debug(`DEBUG-1: power: ${power}, fanRate: ${fanRate}`);

        // make sure to map power off to zero speed
        // otherwise the Home app has display consistency issues
        if (power !== Airbase.Power.ON) {
            this.log.debug(`DEBUG-2: power is off`);
            return 0;
        }

        let fanStep;
        switch (fanRate) {
            default:
            case Airbase.FanSpeed.LOW:
                fanStep = 1;
                break;
            case Airbase.FanSpeed.MEDIUM:
                fanStep = 2;
                break;
            case Airbase.FanSpeed.HIGH:
                fanStep = 3;
                break;
        }

        this.log.debug(`DEBUG-3: fanStep ${fanStep}, fanSpeedSteps ${this.fanSpeedSteps}`);

        return fanStep * this.fanSpeedSteps;
    }

And then restart the homebridge server to see what it prints.

Hey @jasongerbes, did you have time to look into what I suggested above?

@jasongerbes any news from your side?

Hey @yenoiwesa, thanks for following up. I have made the suggested changes and here is the logging output:

DEBUG-1: power: 1, fanRate: 1
DEBUG-3: fanStep 1, fanSpeedSteps 33.33

Hey @jasongerbes, thank you for that! According to what you sent me, the plugin responds to HomeKit with the right information, it shows that the fan speed should be shown at 33% of the fan slider. So I don't see anything wrong with the code per se.

Can you reproduce the issue consistently? If yes, what are your exact steps? I'd like to reproduce at home.
Thanks!

It seems to happen when the fan speed is set to 33.33%.

Try the following reproduction steps:

  1. Set fan speed to 33.33%.
  2. Restart homebridge.
  3. Check fan speed in Home (should be 0%).

33.33 and 66.66 - rounding?

Okay I have managed to reproduce this issue very consistently. It seems to be new from a recent version of iOS.
HAP JS's documentation shows the RotationSpeed characteristic is supposed to accept a float value, and HomeKit does send a float value with 2 digit precision when the user moves the fan speed slider: 0, 33.33, 66.66 and 100.

The Daikin Airbase plugin returns the correct value, 33.33 for the first step, but somehow now that doesn't work anymore, and the Home app shows it as 0. It does seem to be rounding related but that is very weird, sounds like a bug Apple would have introduced in the Home app. It definitely used to work before.

Either way, I have a fix that consists in sending a ceiled value of the percent command, so now I am sending 34 instead of 33.33 and that seems to work as expected.... 🤷‍♂️

I just released version 3.0.1 of the plugin with the patch. Let me know how that goes!

Thanks @yenoiwesa!

This update seems to have fixed the issue for me

That's great news! Thanks for reporting this and your patience @jasongerbes!