Need help with fan template with the new options

With some help from a forum person I got it working only bug is when I turn it off I get an error in the log but it all works.

fan:  
  - platform: template
    fans:
      jrs_bedroom_window_fan:
        friendly_name: "JR's Bedroom Window Fan"
        value_template: "{{ states('light.jr_s_bedroom_window_fan') }}"
        speed_count: 3
        percentage_template: "{{ (state_attr('light.jr_s_bedroom_window_fan','brightness')/255*100) }}"
        turn_on:
          service: light.turn_on
          entity_id: light.jr_s_bedroom_window_fan
        turn_off:
          service: light.turn_off
          entity_id: light.jr_s_bedroom_window_fan
        set_percentage:
          service: light.turn_on
          entity_id: light.jr_s_bedroom_window_fan
          data_template:
            brightness_pct: "{{percentage}}"
1 Like