King Of Fans MR101Z missing MAX setting

I’m in the process of migrating all my Zigbee devices off SmartThings into HA directly. The fan controllers that I use are missing a fan setting. In HA, I only have low, medium, and high (plus a couple other irrelevant settings).

The actual remote for the fan and SmartThings had low, medium, high, and max. How might I work to get this corrected?

If it matters, this is the fan controller in question:
https://www.homedepot.com/p/Hampton-Bay-Universal-Wink-Enabled-White-Ceiling-Fan-Premier-Remote-Control-99432/206591100

I guess more specifically, do I report this as a bug or feature enhancement? And where do I report it? Is this considered a quirk?

This is the handler I was using in SmartThings:

bdraco looks to be working on a possible ZHA solution for HA, see home-assistant/core#45758 (and home-assistant/core#45407 )

As well as the prerequisite frontend PR that new PR utilizes in https://github.com/home-assistant/frontend/pull/8216 and https://github.com/home-assistant/home-assistant.io/pull/16265

As mentioned there you might still need to update the quirk for kof mr101z in zha-device-handlers: https://github.com/zigpy/zha-device-handlers/blob/b12ebc37790af34253fce4a0c549d05a8ffb995c/zhaquirks/kof/

PS: For reference to others, there is also a zigpy discussion https://github.com/zigpy/zigpy/issues/628

1 Like

This is awesome! I see one of them ‘merged’, does this mean it should be coming soon?

Also, is there a way to account for the ‘breeze’ setting, where it randomly cycles up and down? Not sure which thread to ask about that in…

Unknown as Update zha to use new fan entity model by bdraco · Pull Request #45758 · home-assistant/core · GitHub needs to be merged and then as mentioned you might still need to create a quirk for kof mr101z fans to use “on” as “100%” speed.

https://github.com/zigpy/zha-device-handlers/blob/b12ebc37790af34253fce4a0c549d05a8ffb995c/zhaquirks/kof/kof_mr101z.py

If you or someone else do not add that quirk then suggest submit request to zha-device-handlers or better yet ask the zigpy devs to move your existing King Of Fans MR101Z missing MAX setting · Issue #628 · zigpy/zigpy · GitHub there.

@Hedda At the risk of looking like an idiot, who are the devs? :smiley:

First look at any Python programmer/scripter who themselves own or have access to a such kof mr101z fan as personal interest is usually the number one motivator and having access to the specific device most of the time essential. So maybe people who contributed so far? Looks to be Shulyaka, andyzickler, and prairiesnpr?

https://github.com/zigpy/zha-device-handlers/blob/b12ebc37790af34253fce4a0c549d05a8ffb995c/zhaquirks/kof/kof_mr101z.py

dmulcahey and Adminiuga are listed as contributers there too but that is because they are developers of the zha-device-handlers and the zigpy libraries/projects and as such they probably do not own that specific device, however, they might be able to assist other developers who own that device if they need advice.

Update: walthowd also mentioned he has a KoF in Update zha to use new fan entity model by bdraco · Pull Request #45758 · home-assistant/core · GitHub

Again, best is probably to ask nicle once more in King Of Fans MR101Z missing MAX setting · Issue #628 · zigpy/zigpy · GitHub after that Update zha to use new fan entity model by bdraco · Pull Request #45758 · home-assistant/core · GitHub pull request has been merged into Home Assistant

1 Like

Setting the fan to “Smart” will activate the breeze mode.

1 Like

FYI, the ZHA pull request Update zha to use new fan entity model by bdraco · Pull Request #45758 · home-assistant/core · GitHub for the new fan entity model has now been merged into Home Assistant core.

So I believe that you could now start to look at fan speed quirk for zha-device-handlers of specific models of different fans(?).

That’s something that would need to be added to zha-device-handlers/zhaquirks/kof/kof_mr101z.py at b12ebc37790af34253fce4a0c549d05a8ffb995c · zigpy/zha-device-handlers · GitHub before we could add it in HA.

Note however that some fan speed interpretation inconsistencies in Home Assistant so bdraco is now also working on additional new pull requests for Home Assistant core ( Implement percentage step sizes for fans by bdraco · Pull Request #46512 · home-assistant/core · GitHub and Cleanup inconsistencies in zha fan and make it a bit more dry by bdraco · Pull Request #46714 · home-assistant/core · GitHub ) which will add fan speed procentage interpretation support which in turn will allow for the addition of “fan.increase_speed” and “fan.decrease_speed” commands in Home Assistant. This is really needed for intuitive voice assistant control of fan speeds via Amazon Alexa / Amazon Echo and Google Assistant / Google Home speakers.

Therefor any quirks in zha-device-handlers might have to be updated again later to implement percentage step sizes for all fans.

1 Like

Its great news to see so much movement on this! Wow!

edit: Is there a request that needs to be raised to fix the actual setting of this fan? It seems this would happen in the quirk, correct?

Additionally, anyone have a blog post or other good information on how these quirks are created and solved? I’d sure like to actually be able to help one day.

You already raised an issue but you could ask the devs to move that issue to zha-device-handlers repo:

https://github.com/zigpy/zigpy/issues/628

That repository called “ZHA Device Handlers” on GitHub has a README.md which has all the details.

Also read ZHA sections about ZHA exception and deviation handling, Reporting issues, Debug logging:

https://www.home-assistant.io/integrations/zha/

https://www.home-assistant.io/integrations/zha/#zha-exception-and-deviation-handling

https://www.home-assistant.io/integrations/zha/#reporting-issues

https://www.home-assistant.io/integrations/zha/#debug-logging

1 Like

It doesn’t appear that the issue has been moved. What is proper etiquette? Should I create a new issue in quirks?

Apologies, as clearly I’m new. Thanks for any help.

Suggest to wait for another weak or so and then try bump that issue by again asking for it to be moved.

You have to understand and remember that everyone contributing to ZHA and zigpy are not getting paid to do so, these are still only hobby projects that people volenteer to work on for free for the fun of it.

1 Like

Oh I totally understand that! I’m trying to temper my excitement and be respectful. :wink:

1 Like

I really wish I understood quirks a bit better, I feel like it would almost be easier than what I did. But maybe I think that because I don’t understand quirks. :laughing:

Anyway, I was able to put together a template and scripts to deal with the new percentages and presets of this fan controller. Figured I’d post it in case anyone else found it helpful.

This is my first template, so there’s probably a ton wrong. I welcome any criticism.

TEMPLATE:

fan:
  - platform: template
    fans:
      office_fan:
        friendly_name: "Office fan temp"
        unique_id: "jdfskl43443"
        value_template: "{{ states('fan.office') }}"
        percentage_template: "{{ states('input_number.office_fan_percentage') }}"
        preset_mode_template: "{{ states('input_select.office_fan_preset_mode') }}"
        turn_on:
          service: fan.turn_on
          entity_id: fan.office
        turn_off:
          - service: fan.turn_off
            entity_id: fan.office
          - service: input_number.set_value
            data_template:
              entity_id: input_number.office_fan_percentage
              value: 0
        set_percentage:
          service: script.office_fan_set_percentage
          data:
            percentage: "{{ percentage }}"
        set_preset_mode:
          service: script.office_fan_set_preset_mode
          data_template:
            preset_mode: "{{ preset_mode }}"
        preset_modes:
          - 'max'
          - 'breeze'

SCRIPTS:

office_fan_preset_low:
  sequence:
  - service: input_number.set_value
    target:
      entity_id: input_number.office_fan_percentage
    data:
      value: 25
  - service: fan.turn_on
    data:
      percentage: 33
    target:
      entity_id: fan.office
  mode: single
office_fan_preset_medium:
  sequence:
  - service: input_number.set_value
    target:
      entity_id: input_number.office_fan_percentage
    data:
      value: 50
  - service: fan.turn_on
    data:
      percentage: 66
    target:
      entity_id: fan.office
  mode: single
office_fan_preset_high:
  sequence:
  - service: input_number.set_value
    target:
      entity_id: input_number.office_fan_percentage
    data:
      value: 75
  - service: fan.turn_on
    data:
      percentage: 100
    target:
      entity_id: fan.office
  mode: single
office_fan_preset_max:
  sequence:
  - service: input_number.set_value
    target:
      entity_id: input_number.office_fan_percentage
    data:
      value: 100
  - service: fan.turn_on
    data: {}
    target:
      entity_id: fan.office
  - service: fan.set_preset_mode
    target:
      entity_id: fan.office
    data:
      preset_mode: 'on'
  mode: single
office_fan_preset_breeze:
  sequence:
  - service: input_number.set_value
    target:
      entity_id: input_number.office_fan_percentage
    data:
      value: 0
  - service: fan.turn_on
    data: {}
    target:
      entity_id: fan.office
  - service: fan.set_preset_mode
    target:
      entity_id: fan.office
    data:
      preset_mode: smart
  mode: single
office_fan_set_preset_mode:
  sequence:
  - service: script.turn_on
    data_template:
      entity_id: script.office_fan_preset_{{ preset_mode }}
office_fan_set_percentage:
  sequence:
  - service: input_number.set_value
    target:
      entity_id: input_number.office_fan_percentage
    data_template:
      value: '{{ percentage }}'
  - choose:
    - conditions:
      - condition: numeric_state
        entity_id: input_number.office_fan_percentage
        below: 1
      sequence:
      - service: fan.turn_off
        target:
          entity_id: fan.office
    - conditions:
      - condition: numeric_state
        entity_id: input_number.office_fan_percentage
        below: 26
      sequence:
      - service: script.office_fan_preset_low
    - conditions:
      - condition: numeric_state
        entity_id: input_number.office_fan_percentage
        below: 51
      sequence:
      - service: script.office_fan_preset_medium
    - conditions:
      - condition: numeric_state
        entity_id: input_number.office_fan_percentage
        below: 76
      sequence:
      - service: script.office_fan_preset_high
    - conditions:
      - condition: numeric_state
        entity_id: input_number.office_fan_percentage
        below: 101
      sequence:
      - service: script.office_fan_preset_max
    default: []
  mode: single
office_fan_turn_off:
  sequence:
  - service: fan.turn_off
    target:
      entity_id: fan.office
  - service: input_number.set_value
    target:
      entity_id: input_number.office_fan_percentage
    data:
      value: 0
  mode: single

edit: Made a couple of adjustments

1 Like

I had not noticed it was missing a speed, but you are right, it is.

I don’t have any idea how to set this up though.

Okay, updated it again. It now works with Alexa as well, with the exception of my define preset modes: max and breeze.

Anyone know why those don’t work with Alexa?

@jbouwh I see you recently had some PRs merged around fans and Alexa. Any chance you could shed some light on what I’m doing wrong with my presets?

There was an issue where legacy speeds still were needed that was solved, have a look at the PR. I also got google Assistant working with fans. The type of the fan does not matter. Speed percentage, preset modes and legacy speeds (at least for a while) should work fine now.

Then my template must be wrong. Any chance you might take a look at it? It’s a couple posts up.