Migrate fan services to support translations ()

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
pull/96480/head
Franck Nijhof 2023-07-12 13:54:06 +02:00 committed by GitHub
parent aca91db8b5
commit 352ca0b7f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 95 additions and 37 deletions
homeassistant/components/fan

View File

@ -1,7 +1,5 @@
# Describes the format for available fan services
set_preset_mode:
name: Set preset mode
description: Set preset mode for a fan device.
target:
entity:
domain: fan
@ -9,16 +7,12 @@ set_preset_mode:
- fan.FanEntityFeature.PRESET_MODE
fields:
preset_mode:
name: Preset mode
description: New value of preset mode.
required: true
example: "auto"
selector:
text:
set_percentage:
name: Set speed percentage
description: Set fan speed percentage.
target:
entity:
domain: fan
@ -26,8 +20,6 @@ set_percentage:
- fan.FanEntityFeature.SET_SPEED
fields:
percentage:
name: Percentage
description: Percentage speed setting.
required: true
selector:
number:
@ -36,15 +28,11 @@ set_percentage:
unit_of_measurement: "%"
turn_on:
name: Turn on
description: Turn fan on.
target:
entity:
domain: fan
fields:
percentage:
name: Percentage
description: Percentage speed setting.
filter:
supported_features:
- fan.FanEntityFeature.SET_SPEED
@ -54,8 +42,6 @@ turn_on:
max: 100
unit_of_measurement: "%"
preset_mode:
name: Preset mode
description: Preset mode setting.
example: "auto"
filter:
supported_features:
@ -64,15 +50,11 @@ turn_on:
text:
turn_off:
name: Turn off
description: Turn fan off.
target:
entity:
domain: fan
oscillate:
name: Oscillate
description: Oscillate the fan.
target:
entity:
domain: fan
@ -80,22 +62,16 @@ oscillate:
- fan.FanEntityFeature.OSCILLATE
fields:
oscillating:
name: Oscillating
description: Flag to turn on/off oscillation.
required: true
selector:
boolean:
toggle:
name: Toggle
description: Toggle the fan on/off.
target:
entity:
domain: fan
set_direction:
name: Set direction
description: Set the fan rotation.
target:
entity:
domain: fan
@ -103,20 +79,14 @@ set_direction:
- fan.FanEntityFeature.DIRECTION
fields:
direction:
name: Direction
description: The direction to rotate.
required: true
selector:
select:
options:
- label: "Forward"
value: "forward"
- label: "Reverse"
value: "reverse"
- "forward"
- "reverse"
translation_key: direction
increase_speed:
name: Increase speed
description: Increase the speed of the fan by one speed or a percentage_step.
target:
entity:
domain: fan
@ -126,7 +96,6 @@ increase_speed:
percentage_step:
advanced: true
required: false
description: Increase speed by a percentage.
selector:
number:
min: 0
@ -134,8 +103,6 @@ increase_speed:
unit_of_measurement: "%"
decrease_speed:
name: Decrease speed
description: Decrease the speed of the fan by one speed or a percentage_step.
target:
entity:
domain: fan
@ -145,7 +112,6 @@ decrease_speed:
percentage_step:
advanced: true
required: false
description: Decrease speed by a percentage.
selector:
number:
min: 0

View File

@ -52,5 +52,97 @@
}
}
}
},
"services": {
"set_preset_mode": {
"name": "Set preset mode",
"description": "Sets preset mode.",
"fields": {
"preset_mode": {
"name": "Preset mode",
"description": "Preset mode."
}
}
},
"set_percentage": {
"name": "Set speed",
"description": "Sets the fan speed.",
"fields": {
"percentage": {
"name": "Percentage",
"description": "Speed of the fan."
}
}
},
"turn_on": {
"name": "Turn on",
"description": "Turns fan on.",
"fields": {
"percentage": {
"name": "[%key:component::fan::services::set_percentage::fields::percentage::name%]",
"description": "[%key:component::fan::services::set_percentage::fields::percentage::description%]"
},
"preset_mode": {
"name": "[%key:component::fan::services::set_preset_mode::fields::preset_mode::name%]",
"description": "[%key:component::fan::services::set_preset_mode::fields::preset_mode::description%]"
}
}
},
"turn_off": {
"name": "Turn off",
"description": "Turns fan off."
},
"oscillate": {
"name": "Oscillate",
"description": "Controls oscillatation of the fan.",
"fields": {
"oscillating": {
"name": "Oscillating",
"description": "Turn on/off oscillation."
}
}
},
"toggle": {
"name": "Toggle",
"description": "Toggles the fan on/off."
},
"set_direction": {
"name": "Set direction",
"description": "Sets the fan rotation direction.",
"fields": {
"direction": {
"name": "Direction",
"description": "Direction to rotate."
}
}
},
"increase_speed": {
"name": "Increase speed",
"description": "Increases the speed of the fan.",
"fields": {
"percentage_step": {
"name": "Increment",
"description": "Increases the speed by a percentage step."
}
}
},
"decrease_speed": {
"name": "Decrease speed",
"description": "Decreases the speed of the fan.",
"fields": {
"percentage_step": {
"name": "Decrement",
"description": "Decreases the speed by a percentage step."
}
}
}
},
"selector": {
"direction": {
"options": {
"forward": "Forward",
"reverse": "Reverse"
}
}
}
}