Need help with fan template with the new options

good that it’s working now.

I’m not sure how long the named speeds will continue to work tho.

I believe from reading the release notes those shouldn’t be around much longer.

Unless the wording is just muddled and those will continue to work as they do now. :man_shrugging:

That will be a nice surprise if so. :slightly_smiling_face:

Once I get a bit more time I’ve got a template fan I was playing around with using presets that works fairly well. And I need to work out how to use the preset modes with the template fans too.

Once I get those worked out I’ll probably post another how-to for the template fans like the one for the mqtt fan. Hopefully they will be useful to people and help them from banging their heads against a a wall trying to figure out the new control paradigm.

Also having z-wave fan switch (light entity) that i can dim (brightness). Stil trying to figure out this shit but no luck. All i figured out so far is: speed_count: 3 but no idéa how to make my fan have speeds like 32%, 64% and 84% (its ventilation). Now all i got is 33, 66 and 100 % :confused: hoping that someone will post a good exemple soon :z

What type of switch is it? When I upgraded to 2021.4.0 suddenly the “light.bedroom_fan” became unavailable and there was new fan entity with the default name for the switch (Inovelli LZW36). I don’t know if a change was made in Zwave_JS integration that triggered that change but Zwave_js2mqtt was updated a day or two prior without causing that to happen then on the upgrade there it was. Worth peeking at your Zwave device to see if you maybe got a new entity also?

It is a qubino dimmer. I am still using the old z-wave integration, but I will try to upgrade to z-wave JS and see what happens. I am using alot zigbee2mqtt but now zwave2mqtt, maybe should try that :slight_smile: i wall come back to you with result. thx

What happens if you leave out the “speed_count: 3” from the config?

you should then end up with a step of 1 in stead of a step of 33.3333333. Then you should be able to use the slider to set the desired percentages to whatever you want.

Yes, thats true. But I want to have 3 speeds, but preconfigured with 32, 64 and 84 percent - and name those to “Low, med and high” for exemple

What is the significance of those specific speed percentages? Is the fan actually capable of discerning between 64% & 67% or 84% & 100%?

if all you had before was low, medium, high then 33% 67% and 100% are those functional equivalents in the config.

It did not have low, medium and high by it self. Its a dimmer and probably used for lights, but i use it for my home ventilation. I made a template fan and made 3 speeds in the code, and the speeds where as writen above, and then I named the speeds “low,mid and high”.

then instead of using percentages then look at using preset modes.

As of this moment I am convinced that you can use presets of low, medium and high then in the preset template set the percentages to what the corresponding percentages should be.

I think it might work.

I guess what I’m not understanding in this conversation is if the switch you guys are using is actually designed as a light dimmer or fan speed controller?

And how does it actually control the physical fan connected to it.

Does the fan have certain speeds (discrete low medium high speeds like is controlled by relays) or does it take variable speed outputs (as in a variable speed motor controller)?

here you have it. I am not using the switch, just the light entity to dim my ventilation / fan. Same as a light but its a fan :slight_smile:

I have searched but no luck with finding any exemples to create preset template :confused:

Could you post the template fan config as it was that worked before the latest changes?

Hi. I dont have the old setup but I am sure I used this code and changed to my entity name and made 3 speeds instead.

I can’t be sure it will work since I don’t have your devices but this might work based on the code you linked to:

  - platform: template
    fans:
      one1in:
        friendly_name: "one1in"
        value_template: "{{ states('light.60600011ecfabcab8f89') }}"
        percentage_template: >
          {% set output = {0:0, 140:33, 200:66, 255:100} %}
          {% set idx = state_attr('light.60600011ecfabcab8f89', 'brightness') %}
          {{ output[idx] }}
        turn_on:
          service: homeassistant.turn_on
          entity_id: light.60600011ecfabcab8f89
        turn_off:
          service: homeassistant.turn_off
          entity_id: light.60600011ecfabcab8f89
        set_percentage:
          service: homeassistant.turn_on
          entity_id: light.60600011ecfabcab8f89
          data_template:
            brightness: >
              {% set mapper = {0: 0, 33: 140, 66: 200, 100: 255} %}
              {{ mapper[percentage] }}
        speed_count: 3

you will need to change it to your entity but try it and see if it works.

That won’t work, your templates are correct but you should edit the post and make the services light.turn_on/off

I figured it either worked before or they knew how to change it to make it work.

it might have been different if they were able to post their actual previously working code.

But at least it gets them started. :slightly_smiling_face:

Thanks alot for the help! I changed what I should but nothing happens. Here is the old code and new code:

 qubino:
   friendly_name: "Frånluftsventilation"
   value_template: "{{ states('light.qubino_goap_zmnhvdx_flush_dimmer_0_10v_level') }}"
   speed_count: 3
   percentage_template: "{{ (state_attr('light.qubino_goap_zmnhvdx_flush_dimmer_0_10v_level','brightness') | int /255*100) | int}}"
   turn_on:
     service: light.turn_on
     entity_id: light.qubino_goap_zmnhvdx_flush_dimmer_0_10v_level
   turn_off:
     service: light.turn_off
     entity_id: light.qubino_goap_zmnhvdx_flush_dimmer_0_10v_level
   set_percentage:
     service: light.turn_on
     entity_id: light.qubino_goap_zmnhvdx_flush_dimmer_0_10v_level
     data_template:
       brightness_pct: "{{percentage}}"
       
 test_qubino:
   friendly_name: "test qubino"
   value_template: "{{ states('light.qubino_goap_zmnhvdx_flush_dimmer_0_10v_level') }}"
   percentage_template: >
     {% set output = {0:0, 140:33, 200:66, 255:100} %}
     {% set idx = state_attr('light.qubino_goap_zmnhvdx_flush_dimmer_0_10v_level', 'brightness') %}
     {{ output[idx] }}
   turn_on:
     service: light.turn_on
     entity_id: light.qubino_goap_zmnhvdx_flush_dimmer_0_10v_level
   turn_off:
     service: light.turn_off
     entity_id: light.qubino_goap_zmnhvdx_flush_dimmer_0_10v_level
   set_percentage:
     service: light.turn_on
     entity_id: light.qubino_goap_zmnhvdx_flush_dimmer_0_10v_level
     data_template:
       brightness: >
         {% set mapper = {0: 0, 33: 140, 66: 200, 100: 255} %}
         {{ mapper[percentage] }}
   speed_count: 3

When I set the old fan to 66 %, nothing changes with test_qubino…

The only thing I see is trhat I forgot to convert the brightness number (0-255) to percent (0-100).

try this in place of your percentage_template:

percentage_template: >
  {% set output = {0:0, 140:33, 200:66, 255:100} %}
  {% set idx = ((state_attr('light.qubino_goap_zmnhvdx_flush_dimmer_0_10v_level', 'brightness') | int /255) * 100) | int %}
  {{ output[idx] }}

I had to build a test template light but I could control the fan speed from the light and the light brightness from the fan. So I’m pretty sure it works.

If you would like to not have the speed list deprecated I’ve requested that the old speed list options should be kept and I’ve had a suggestion from a dev that if a FR gets enough votes they would implement it.

Here is the FR. Please go there and vote it up.