syssi / xiaomi_fan

Xiaomi Mi Smart Fan integration for Home Assistant
Apache License 2.0
413 stars 117 forks source link

percentage_step is always 25 for dmaker.fan.p39 #247

Open csharpfaze opened 4 months ago

csharpfaze commented 4 months ago

I use the xiaomi smart tower fan (dmaker.fan.p39) and noticed that the control via cards is very limited.

By default, the more-info dialog is pretty nice and can be used as a card:

type: custom:more-info-card
entity: fan.xiaomi_smart_fan
title: Fan Control

But controlling the fan speed is only allowed in 25%-steps (dictated through the amount of preset_modes as far as I know) State:

preset_modes:
  - "off"
  - Level 1
  - Level 2
  - Level 3
  - Level 4
direction: null
oscillating: false
percentage: 50
percentage_step: 25
...

For me personally I changed it directly to 1%-steps in a new property:

class XiaomiFanP39(XiaomiFanMiot):
    """Representation of a Xiaomi Fan P39."""

    @ property
    def percentage_step(self):
        return 1

Ideally, the percentage_step would have to be calculated by the possible values for the corresponding fan, so there should be better ways to implement this.

Is this worth mentioning or are most people using the service calls directly in order to control the exact percentage?