King Of Fans MR101Z missing MAX setting

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.

Do not use speed_count and speeds. Use percentage based speeds.

1 Like

As expected, you’re a genius! That worked!

Now I just need to figure out why when I tell Alexa to set it to ‘breeze’ it starts asking me about my Ecobee thermostat.

I ended up using Node red and seting the fan to 1% on Alexa activates breeze mode. It relies on zigbee2mqtt and a node red Alexa skill though.

Zigbee2mqtt has a pending PR that should fix this template and have all 4 speeds and breeze mode working on the next release for this fan too.

I posted the Node red flow here Unable to get Home Decorator / Hampton Bay Zigbee fan to pair - #18 by mwav3

@flyize sorry for the dumb question but I just made the move to HA and after moving over my KoF’s I also noticed the high fan speed was missing. How do I setup the template and the script for the fan? I currently have 5 KoF’s so I assume I need to do this for each fan?

I don’t know about zha, but in zigbee2mqtt you can control all 4 speeds and smart mode of the fan directly through Home Assistant now. This fan and getting full control was one of the reasons I opted for zigbee2mqtt over zha:

119249329-4e016900-bb5d-11eb-8029-c1d05fb81d0f

The PR was done recently in zigbee2mqtt to fix this - https://github.com/Koenkk/zigbee2mqtt/pull/7359

There are still some minor warnings in Home Assistant though for templating issues - I filed an issue with zigbee2mqtt to hopefully fix it. If not, you can do an MQTT template yourself to clear all the errors. More info on that here - https://github.com/Koenkk/zigbee2mqtt/issues/8617

Welcome! I’d just move this project down your list for right now. While you get up to speed, its going to be like trying to drink from a firehose. Templates took me quite a while to wrap my head around. Hopefully you’ll pick it up quicker. Either way, the docs are here:

@mwav3 thanks for the info but unfortunately my zigbee dongle is not support so that isn’t an option for me.

Thanks @flyize. Sadly I’m not very good with this stuff so its a bit challenging at the moment. Where I’m stuck is where to put the code you have posted above? I assume they need to be pasted into one of the *.yaml files. I’ve tried pasting the code in a couple different yaml files (scripts.yaml, configuration.yaml) and changed the values to match my device but either I put in the wrong place or changed the wrong value or missed something else.

I was able to get this working somewhat. The problem i’m facing is with the fan speed slider. It doesn’t seem to do anything. Looks like this may be the problem as the results are unknown in the template editor. Any ideas on what needs to be changed?

   ` percentage_template: "{{ states('input_number.office_fan_percentage') }}" `
   ` preset_mode_template: "{{ states('input_select.office_fan_preset_mode') }}" `

Configuration > Helpers

Add some new input_numbers.