That didn’t seem to help. @jbouwh any way you might be able to shed some light on how to ‘breeze’ to work for this template?
There is a resolved issue with Alexa where the percentage_step is not an integer.
Further the use of templates for fans is not yet supported yet, but that will be resolved too.
You could use a MQTT fan to test if presets work.
So will both of these be in 2021.11?
Yes, it should be expected both issues will be fixed with the coming release
I have this problem. I’m using zha and the fan was automatically found. How do I get all four speeds out of my fan?
Think that you need to re-open these issues and try to convince ZHA Device Handlers developers to address this in the quirk for it if you are not can not extend the code for it yourself in that quirk:
https://github.com/zigpy/zha-device-handlers/issues/1092
https://github.com/zigpy/zigpy/issues/628
The reason is ZHA exception and deviation handling which is explained in ZHA documentation here:
https://www.home-assistant.io/integrations/zha#zha-exception-and-deviation-handling
I’m new to Home Assistant (started migrating from SmartThings last week) and I just wrote the following template fan.
It creates a new template fan that has four speeds (25, 50, 75, 100) and two preset modes (auto, smart).
The original fan has 3 speeds (33, 66, 100) and three preset modes (on, auto, smart).
The code maps (33, 66, 100, on, auto, smart) to (25, 50, 75, 100, auto, smart).
Advantages of this template fan compared to the one @flyize provided in 15 are:
- simpler and easier to setup. No scripts and input helpers are needed
- most importantly the states of the template and real fans are synced
Add the following to /config/configuration.yaml and replace foo with your fan name.
fan:
- platform: template
fans:
foo_fan:
friendly_name: "foo fan"
unique_id: "foo_fan"
value_template: "{{ states('fan.foo') }}"
percentage_template: >
{% if is_state_attr('fan.foo', 'preset_mode', 'on') %}
100
{% else %}
{{ (state_attr('fan.foo', 'percentage') * 3 / 4) | round}}
{% endif %}
preset_mode_template: >
{% if is_state_attr('fan.foo', 'preset_mode', 'on') %}
None
{% else %}
{{state_attr('fan.foo', 'preset_mode')}}
{% endif %}
turn_on:
service: fan.turn_on
entity_id: fan.foo
turn_off:
service: fan.turn_off
entity_id: fan.foo
set_percentage:
if:
condition: template
value_template: "{{ percentage == 100 }}"
then:
service: fan.set_preset_mode
target:
entity_id: fan.foo
data:
preset_mode: 'on'
else:
service: fan.set_percentage
target:
entity_id: fan.foo
data_template:
percentage: "{{ (percentage * 4 / 3) | int }}"
set_preset_mode:
service: fan.set_preset_mode
target:
entity_id: fan.foo
data_template:
preset_mode: "{{ preset_mode }}"
speed_count: 4
preset_modes:
- 'auto'
- 'smart'
Nice work!
My problem is the KOF fan won’t ever go to 100%, even though I move the slider all the way to the right. In Smartthings I was able to get the full fan speed, but not since moving to HA.
Will this fix that problem? If so, I have only one KOF fan. If I enter this template in config, will it try to apply it to all of my fans? Only the KOF has 4 speeds. The others all have only 3. Thanks
Yes, it will fix your problem. No, it will only apply to whatever fan you specify. Make sure you replace all occurrences of foo with the correct entity id.
Good stuff! But maybe make it a Blueprint for Home Assistant making it easier to share and find? See:
https://www.home-assistant.io/docs/blueprint/
https://www.home-assistant.io/docs/blueprint/tutorial/
https://www.home-assistant.io/docs/automation/using_blueprints/
https://www.home-assistant.io/examples/
https://community.home-assistant.io/c/blueprints-exchange/53?page=1
Also checkout:
AFAICT, we cannot have blueprints for fan templates.
Improve ZHA King of Fans by tronikos · Pull Request #101859 · home-assistant/core · GitHub that should be included in 2023.11.0 fixes this.
Wow, nice work!
My fix applies at HBUniversalCFRemote
and HDC52EastwindFan
models. If your device is a different model we will have to add it below:
The PR made it in the 2023.11.0 cut. Keep in mind it’s a breaking change since it breaks template fan workarounds and service calls that set the preset to ‘on’.
So this update actually broke my fan control and hoping for a workaround.
Unlike many in this thread, the fan paired with my KoF controller only has 3 speeds. Previously, this worked fine with the default controls (with settings of 33%, 66% and 100%), but with the updated code (and 4 speeds), my fan maxes out at the 75% setting. If I set it to 100% it just shuts off.
Any ideas on where to go from here with the new code? It’s not clear to me how to fix this.
Aren’t the speeds set by the controller? If you have the KoF controller, you have a 4 speed fan. I could be wrong, but I don’t think the actual motor cares.
One would think that, sure…but that’s not the case. I’m using the KoF controller but it’s never worked with 4 fan speeds on the controller side (either via home assistant or home bridge).
Is there any way to adjust the percentages now that the new code has been released?
That’s very odd. I have a traditional 3 speed pull fan, and even it has 4 speeds with the KoF controller.