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
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 %}