Update template fan for new entity model (#16290)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
J. Nick Koston 2021-01-28 06:14:28 -06:00 committed by GitHub
parent 676419da0c
commit 6f10f8ae8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,8 +10,8 @@ ha_domain: template
--- ---
The `template` platform creates fans that combine integrations and provides the 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`, ability to run scripts or invoke services for each of the `turn_on`, `turn_off`, `set_percentage`,
`set_oscillating`, and `set_direction` commands of a fan. `set_preset_mode`, `set_oscillating`, and `set_direction` commands of a fan.
To enable Template Fans in your installation, add the following to your To enable Template Fans in your installation, add the following to your
`configuration.yaml` file: `configuration.yaml` file:
@ -26,17 +26,22 @@ fan:
bedroom_fan: bedroom_fan:
friendly_name: "Bedroom fan" friendly_name: "Bedroom fan"
value_template: "{{ states('input_boolean.state') }}" 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') }}" oscillating_template: "{{ states('input_select.osc') }}"
direction_template: "{{ states('input_select.direction') }}" direction_template: "{{ states('input_select.direction') }}"
turn_on: turn_on:
service: script.fan_on service: script.fan_on
turn_off: turn_off:
service: script.fan_off service: script.fan_off
set_speed: set_percentage:
service: script.fan_speed service: script.fans_set_speed
data: data:
speed: "{{ speed }}" percentage: "{{ percentage }}"
set_preset_mode:
service: script.fans_set_preset_mode
data:
preset_mode: "{{ preset_mode }}"
set_oscillating: set_oscillating:
service: script.fan_oscillating service: script.fan_oscillating
data: data:
@ -45,10 +50,10 @@ fan:
service: script.fan_direction service: script.fan_direction
data: data:
direction: "{{ direction }}" direction: "{{ direction }}"
speeds: preset_modes:
- '1' - 'auto'
- '2' - 'smart'
- '3' - 'woosh'
``` ```
{% endraw %} {% endraw %}
@ -71,8 +76,12 @@ fan:
description: "Defines a template to get the state of the fan. Valid values: `on`, `off`" description: "Defines a template to get the state of the fan. Valid values: `on`, `off`"
required: true required: true
type: template type: template
speed_template: percentage_template:
description: Defines a template to get the speed of the fan. 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 required: false
type: template type: template
oscillating_template: oscillating_template:
@ -96,8 +105,8 @@ fan:
description: Defines an action to run when the fan is turned off. description: Defines an action to run when the fan is turned off.
required: true required: true
type: action type: action
set_speed: set_percentage:
description: Defines an action to run when the fan is given a speed command. description: Defines an action to run when the fan is given a speed percentage command.
required: false required: false
type: action type: action
set_oscillating: set_oscillating:
@ -108,9 +117,9 @@ fan:
description: Defines an action to run when the fan is given a direction command. description: Defines an action to run when the fan is given a direction command.
required: false required: false
type: action type: action
speeds: preset_modes:
description: List of speeds the fan is capable of running at. description: List of preset modes the fan is capable of.
required: false required: false
type: [string, list] type: [string, list]
default: ['low', 'medium', 'high'] default: []
{% endconfiguration %} {% endconfiguration %}