From 6f10f8ae8bc4718a5dc0b6378929df7616badd94 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 28 Jan 2021 06:14:28 -0600 Subject: [PATCH] Update template fan for new entity model (#16290) Co-authored-by: Franck Nijhof --- source/_integrations/fan.template.markdown | 43 +++++++++++++--------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/source/_integrations/fan.template.markdown b/source/_integrations/fan.template.markdown index 35bac403e6b..86a57d06443 100644 --- a/source/_integrations/fan.template.markdown +++ b/source/_integrations/fan.template.markdown @@ -10,8 +10,8 @@ ha_domain: template --- The `template` platform creates fans that combine integrations and provides the -ability to run scripts or invoke services for each of the `turn_on`, `turn_off`, `set_speed`, -`set_oscillating`, and `set_direction` commands of a fan. +ability to run scripts or invoke services for each of the `turn_on`, `turn_off`, `set_percentage`, +`set_preset_mode`, `set_oscillating`, and `set_direction` commands of a fan. To enable Template Fans in your installation, add the following to your `configuration.yaml` file: @@ -26,17 +26,22 @@ fan: bedroom_fan: friendly_name: "Bedroom fan" value_template: "{{ states('input_boolean.state') }}" - speed_template: "{{ states('input_select.speed') }}" + percentage_template: "{{ states('input_number.percentage') }}" + preset_mode_template: "{{ states('input_select.preset_mode') }}" oscillating_template: "{{ states('input_select.osc') }}" direction_template: "{{ states('input_select.direction') }}" turn_on: service: script.fan_on turn_off: service: script.fan_off - set_speed: - service: script.fan_speed + set_percentage: + service: script.fans_set_speed data: - speed: "{{ speed }}" + percentage: "{{ percentage }}" + set_preset_mode: + service: script.fans_set_preset_mode + data: + preset_mode: "{{ preset_mode }}" set_oscillating: service: script.fan_oscillating data: @@ -45,10 +50,10 @@ fan: service: script.fan_direction data: direction: "{{ direction }}" - speeds: - - '1' - - '2' - - '3' + preset_modes: + - 'auto' + - 'smart' + - 'woosh' ``` {% endraw %} @@ -71,8 +76,12 @@ fan: description: "Defines a template to get the state of the fan. Valid values: `on`, `off`" required: true type: template - speed_template: - description: Defines a template to get the speed of the fan. + percentage_template: + description: Defines a template to get the speed percentage of the fan. + required: false + type: template + preset_mode_template: + description: Defines a template to get the preset mode of the fan. required: false type: template oscillating_template: @@ -96,8 +105,8 @@ fan: description: Defines an action to run when the fan is turned off. required: true type: action - set_speed: - description: Defines an action to run when the fan is given a speed command. + set_percentage: + description: Defines an action to run when the fan is given a speed percentage command. required: false type: action set_oscillating: @@ -108,9 +117,9 @@ fan: description: Defines an action to run when the fan is given a direction command. required: false type: action - speeds: - description: List of speeds the fan is capable of running at. + preset_modes: + description: List of preset modes the fan is capable of. required: false type: [string, list] - default: ['low', 'medium', 'high'] + default: [] {% endconfiguration %}