From d0e0146ddd56c7a81724edd6e5c03b890a29e60f Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 12 Jul 2023 10:07:08 +0200 Subject: [PATCH 1/4] Migrate remote services to support translations --- homeassistant/components/remote/services.yaml | 38 -------- homeassistant/components/remote/strings.json | 86 +++++++++++++++++++ 2 files changed, 86 insertions(+), 38 deletions(-) diff --git a/homeassistant/components/remote/services.yaml b/homeassistant/components/remote/services.yaml index a2b648d9eb31a0..0d8ef63bfc3753 100644 --- a/homeassistant/components/remote/services.yaml +++ b/homeassistant/components/remote/services.yaml @@ -1,15 +1,11 @@ # Describes the format for available remote services turn_on: - name: Turn On - description: Sends the Power On Command. target: entity: domain: remote fields: activity: - name: Activity - description: Activity ID or Activity Name to start. example: "BedroomTV" filter: supported_features: @@ -18,50 +14,36 @@ turn_on: text: toggle: - name: Toggle - description: Toggles a device. target: entity: domain: remote turn_off: - name: Turn Off - description: Sends the Power Off Command. target: entity: domain: remote send_command: - name: Send Command - description: Sends a command or a list of commands to a device. target: entity: domain: remote fields: device: - name: Device - description: Device ID to send command to. example: "32756745" selector: text: command: - name: Command - description: A single command or a list of commands to send. required: true example: "Play" selector: object: num_repeats: - name: Repeats - description: The number of times you want to repeat the command(s). default: 1 selector: number: min: 0 max: 255 delay_secs: - name: Delay Seconds - description: The time you want to wait in between repeated commands. default: 0.4 selector: number: @@ -70,8 +52,6 @@ send_command: step: 0.1 unit_of_measurement: seconds hold_secs: - name: Hold Seconds - description: The time you want to have it held before the release is send. default: 0 selector: number: @@ -81,27 +61,19 @@ send_command: unit_of_measurement: seconds learn_command: - name: Learn Command - description: Learns a command or a list of commands from a device. target: entity: domain: remote fields: device: - name: Device - description: Device ID to learn command from. example: "television" selector: text: command: - name: Command - description: A single command or a list of commands to learn. example: "Turn on" selector: object: command_type: - name: Command Type - description: The type of command to be learned. default: "ir" selector: select: @@ -109,13 +81,9 @@ learn_command: - "ir" - "rf" alternative: - name: Alternative - description: If code must be stored as alternative (useful for discrete remotes). selector: boolean: timeout: - name: Timeout - description: Timeout for the command to be learned. selector: number: min: 0 @@ -124,21 +92,15 @@ learn_command: unit_of_measurement: seconds delete_command: - name: Delete Command - description: Deletes a command or a list of commands from the database. target: entity: domain: remote fields: device: - name: Device - description: Name of the device from which commands will be deleted. example: "television" selector: text: command: - name: Command - description: A single command or a list of commands to delete. required: true example: "Mute" selector: diff --git a/homeassistant/components/remote/strings.json b/homeassistant/components/remote/strings.json index bf8a669af50428..4567abfcf56396 100644 --- a/homeassistant/components/remote/strings.json +++ b/homeassistant/components/remote/strings.json @@ -24,5 +24,91 @@ "on": "[%key:common::state::on%]" } } + }, + "services": { + "turn_on": { + "name": "Turn on", + "description": "Sends the power on command.", + "fields": { + "activity": { + "name": "Activity", + "description": "Activity ID or activity name to start." + } + } + }, + "toggle": { + "name": "Toggle", + "description": "Toggles a device on/off." + }, + "turn_off": { + "name": "Turn off", + "description": "Sends the power off command." + }, + "send_command": { + "name": "Send command", + "description": "Sends a command or a list of commands to a device.", + "fields": { + "device": { + "name": "Device", + "description": "Device ID to send command to." + }, + "command": { + "name": "Command", + "description": "A single command or a list of commands to send." + }, + "num_repeats": { + "name": "Repeats", + "description": "The number of times you want to repeat the command(s)." + }, + "delay_secs": { + "name": "Delay seconds", + "description": "The time you want to wait in between repeated commands." + }, + "hold_secs": { + "name": "Hold seconds", + "description": "The time you want to have it held before the release is send." + } + } + }, + "learn_command": { + "name": "Learn command", + "description": "Learns a command or a list of commands from a device.", + "fields": { + "device": { + "name": "Device", + "description": "Device ID to learn command from." + }, + "command": { + "name": "Command", + "description": "A single command or a list of commands to learn." + }, + "command_type": { + "name": "Command type", + "description": "The type of command to be learned." + }, + "alternative": { + "name": "Alternative", + "description": "If code must be stored as alternative (useful for discrete remotes)." + }, + "timeout": { + "name": "Timeout", + "description": "Timeout for the command to be learned." + } + } + }, + "delete_command": { + "name": "Delete command", + "description": "Deletes a command or a list of commands from the database.", + "fields": { + "device": { + "name": "Device", + "description": "Name of the device from which commands will be deleted." + }, + "command": { + "name": "Command", + "description": "A single command or a list of commands to delete." + } + } + } } } From 88792ed348ba50f051f08551de8ed0d3e7712271 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 12 Jul 2023 15:36:27 +0200 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com> --- homeassistant/components/remote/strings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/remote/strings.json b/homeassistant/components/remote/strings.json index 4567abfcf56396..ebe1ebff0fba5f 100644 --- a/homeassistant/components/remote/strings.json +++ b/homeassistant/components/remote/strings.json @@ -32,7 +32,7 @@ "fields": { "activity": { "name": "Activity", - "description": "Activity ID or activity name to start." + "description": "Activity ID or activity name to be started." } } }, @@ -42,7 +42,7 @@ }, "turn_off": { "name": "Turn off", - "description": "Sends the power off command." + "description": "Turns the device off." }, "send_command": { "name": "Send command", From 64e1b4970891a833bbf163a2818b2a31aceba6cb Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 12 Jul 2023 16:31:13 +0200 Subject: [PATCH 3/4] Update homeassistant/components/remote/strings.json Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com> --- homeassistant/components/remote/strings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/remote/strings.json b/homeassistant/components/remote/strings.json index ebe1ebff0fba5f..6c273142daf238 100644 --- a/homeassistant/components/remote/strings.json +++ b/homeassistant/components/remote/strings.json @@ -58,7 +58,7 @@ }, "num_repeats": { "name": "Repeats", - "description": "The number of times you want to repeat the command(s)." + "description": "The number of times you want to repeat the commands." }, "delay_secs": { "name": "Delay seconds", From ae0552b6b5326dd2c8a1a9421f4e7a0233971b58 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 12 Jul 2023 16:39:16 +0200 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com> --- homeassistant/components/remote/strings.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/remote/strings.json b/homeassistant/components/remote/strings.json index 6c273142daf238..14331c5cded7b6 100644 --- a/homeassistant/components/remote/strings.json +++ b/homeassistant/components/remote/strings.json @@ -88,7 +88,7 @@ }, "alternative": { "name": "Alternative", - "description": "If code must be stored as alternative (useful for discrete remotes)." + "description": "If code must be stored as an alternative. This is useful for discrete codes. Discrete codes are used for toggles that only perform one function. For example, a code to only turn a device on. If it is on already, sending the code won't change the state." }, "timeout": { "name": "Timeout", @@ -102,11 +102,11 @@ "fields": { "device": { "name": "Device", - "description": "Name of the device from which commands will be deleted." + "description": "Device from which commands will be deleted." }, "command": { "name": "Command", - "description": "A single command or a list of commands to delete." + "description": "The single command or the list of commands to be deleted." } } }