From cccf436326e189a4bd9935ec7852e29f11a6424c Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 12 Jul 2023 15:14:10 +0200 Subject: [PATCH] Migrate LaMetric services to support translations (#96415) --- .../components/lametric/services.yaml | 194 +++++------------- .../components/lametric/strings.json | 134 ++++++++++++ 2 files changed, 191 insertions(+), 137 deletions(-) diff --git a/homeassistant/components/lametric/services.yaml b/homeassistant/components/lametric/services.yaml index 3299245fbc0..af04eac5f33 100644 --- a/homeassistant/components/lametric/services.yaml +++ b/homeassistant/components/lametric/services.yaml @@ -1,129 +1,70 @@ chart: - name: Display a chart - description: Display a chart on a LaMetric device. fields: device_id: &device_id - name: Device - description: The LaMetric device to display the chart on. required: true selector: device: integration: lametric data: - name: Data - description: The list of data points in the chart required: true example: "[1,2,3,4,5,4,3,2,1]" selector: object: sound: &sound - name: Sound - description: The notification sound to play. required: false selector: select: options: - - label: "Alarm 1" - value: "alarm1" - - label: "Alarm 2" - value: "alarm2" - - label: "Alarm 3" - value: "alarm3" - - label: "Alarm 4" - value: "alarm4" - - label: "Alarm 5" - value: "alarm5" - - label: "Alarm 6" - value: "alarm6" - - label: "Alarm 7" - value: "alarm7" - - label: "Alarm 8" - value: "alarm8" - - label: "Alarm 9" - value: "alarm9" - - label: "Alarm 10" - value: "alarm10" - - label: "Alarm 11" - value: "alarm11" - - label: "Alarm 12" - value: "alarm12" - - label: "Alarm 13" - value: "alarm13" - - label: "Bicycle" - value: "bicycle" - - label: "Car" - value: "car" - - label: "Cash" - value: "cash" - - label: "Cat" - value: "cat" - - label: "Dog 1" - value: "dog" - - label: "Dog 2" - value: "dog2" - - label: "Energy" - value: "energy" - - label: "Knock knock" - value: "knock-knock" - - label: "Letter email" - value: "letter_email" - - label: "Lose 1" - value: "lose1" - - label: "Lose 2" - value: "lose2" - - label: "Negative 1" - value: "negative1" - - label: "Negative 2" - value: "negative2" - - label: "Negative 3" - value: "negative3" - - label: "Negative 4" - value: "negative4" - - label: "Negative 5" - value: "negative5" - - label: "Notification 1" - value: "notification" - - label: "Notification 2" - value: "notification2" - - label: "Notification 3" - value: "notification3" - - label: "Notification 4" - value: "notification4" - - label: "Open door" - value: "open_door" - - label: "Positive 1" - value: "positive1" - - label: "Positive 2" - value: "positive2" - - label: "Positive 3" - value: "positive3" - - label: "Positive 4" - value: "positive4" - - label: "Positive 5" - value: "positive5" - - label: "Positive 6" - value: "positive6" - - label: "Statistic" - value: "statistic" - - label: "Thunder" - value: "thunder" - - label: "Water 1" - value: "water1" - - label: "Water 2" - value: "water2" - - label: "Win 1" - value: "win" - - label: "Win 2" - value: "win2" - - label: "Wind" - value: "wind" - - label: "Wind short" - value: "wind_short" + - "alarm1" + - "alarm2" + - "alarm3" + - "alarm4" + - "alarm5" + - "alarm6" + - "alarm7" + - "alarm8" + - "alarm9" + - "alarm10" + - "alarm11" + - "alarm12" + - "alarm13" + - "bicycle" + - "car" + - "cash" + - "cat" + - "dog" + - "dog2" + - "energy" + - "knock-knock" + - "letter_email" + - "lose1" + - "lose2" + - "negative1" + - "negative2" + - "negative3" + - "negative4" + - "negative5" + - "notification" + - "notification2" + - "notification3" + - "notification4" + - "open_door" + - "positive1" + - "positive2" + - "positive3" + - "positive4" + - "positive5" + - "positive6" + - "statistic" + - "thunder" + - "water1" + - "water2" + - "win" + - "win2" + - "wind" + - "wind_short" + translation_key: sound cycles: &cycles - name: Cycles - description: >- - The number of times to display the message. When set to 0, the message - will be displayed until dismissed. required: false default: 1 selector: @@ -132,56 +73,35 @@ chart: max: 10 mode: slider icon_type: &icon_type - name: Icon type - description: >- - The type of icon to display, indicating the nature of the notification. required: false default: "none" selector: select: mode: dropdown options: - - label: "None" - value: "none" - - label: "Info" - value: "info" - - label: "Alert" - value: "alert" + - "none" + - "info" + - "alert" + translation_key: icon_type priority: &priority - name: Priority - description: >- - The priority of the notification. When the device is running in - screensaver or kiosk mode, only critical priority notifications - will be accepted. required: false default: "info" selector: select: mode: dropdown options: - - label: "Info" - value: "info" - - label: "Warning" - value: "warning" - - label: "Critical" - value: "critical" - + - "info" + - "warning" + - "critical" + translation_key: priority message: - name: Display a message - description: Display a message with an optional icon on a LaMetric device. fields: device_id: *device_id message: - name: Message - description: The message to display. required: true selector: text: icon: - name: Icon - description: >- - The ID number of the icon or animation to display. List of all icons - and their IDs can be found at: https://developer.lametric.com/icons required: false selector: text: diff --git a/homeassistant/components/lametric/strings.json b/homeassistant/components/lametric/strings.json index 21cebe46f26..ac06e125b0c 100644 --- a/homeassistant/components/lametric/strings.json +++ b/homeassistant/components/lametric/strings.json @@ -78,5 +78,139 @@ "name": "Bluetooth" } } + }, + "services": { + "chart": { + "name": "Display a chart", + "description": "Displays a chart on a LaMetric device.", + "fields": { + "device_id": { + "name": "Device", + "description": "The LaMetric device to display the chart on." + }, + "data": { + "name": "Data", + "description": "The list of data points in the chart." + }, + "sound": { + "name": "Sound", + "description": "The notification sound to play." + }, + "cycles": { + "name": "Cycles", + "description": "The number of times to display the message. When set to 0, the message will be displayed until dismissed." + }, + "icon_type": { + "name": "Icon type", + "description": "The type of icon to display, indicating the nature of the notification." + }, + "priority": { + "name": "Priority", + "description": "The priority of the notification. When the device is running in screensaver or kiosk mode, only critical priority notifications will be accepted." + } + } + }, + "message": { + "name": "Display a message", + "description": "Displays a message with an optional icon on a LaMetric device.", + "fields": { + "device_id": { + "name": "[%key:component::lametric::services::chart::fields::device_id::name%]", + "description": "The LaMetric device to display the message on." + }, + "message": { + "name": "Message", + "description": "The message to display." + }, + "icon": { + "name": "Icon", + "description": "The ID number of the icon or animation to display. List of all icons and their IDs can be found at: https://developer.lametric.com/icons." + }, + "sound": { + "name": "[%key:component::lametric::services::chart::fields::sound::name%]", + "description": "[%key:component::lametric::services::chart::fields::sound::description%]" + }, + "cycles": { + "name": "[%key:component::lametric::services::chart::fields::cycles::name%]", + "description": "[%key:component::lametric::services::chart::fields::cycles::description%]" + }, + "icon_type": { + "name": "[%key:component::lametric::services::chart::fields::icon_type::name%]", + "description": "[%key:component::lametric::services::chart::fields::icon_type::description%]" + }, + "priority": { + "name": "[%key:component::lametric::services::chart::fields::priority::name%]", + "description": "[%key:component::lametric::services::chart::fields::priority::description%]" + } + } + } + }, + "selector": { + "sound": { + "options": { + "alarm1": "Alarm 1", + "alarm2": "Alarm 2", + "alarm3": "Alarm 3", + "alarm4": "Alarm 4", + "alarm5": "Alarm 5", + "alarm6": "Alarm 6", + "alarm7": "Alarm 7", + "alarm8": "Alarm 8", + "alarm9": "Alarm 9", + "alarm10": "Alarm 10", + "alarm11": "Alarm 11", + "alarm12": "Alarm 12", + "alarm13": "Alarm 13", + "bicycle": "Bicycle", + "car": "Car", + "cash": "Cash", + "cat": "Cat", + "dog": "Dog 1", + "dog2": "Dog 2", + "energy": "Energy", + "knock-knock": "Knock knock", + "letter_email": "Letter email", + "lose1": "Lose 1", + "lose2": "Lose 2", + "negative1": "Negative 1", + "negative2": "Negative 2", + "negative3": "Negative 3", + "negative4": "Negative 4", + "negative5": "Negative 5", + "notification": "Notification 1", + "notification2": "Notification 2", + "notification3": "Notification 3", + "notification4": "Notification 4", + "open_door": "Open door", + "positive1": "Positive 1", + "positive2": "Positive 2", + "positive3": "Positive 3", + "positive4": "Positive 4", + "positive5": "Positive 5", + "positive6": "Positive 6", + "statistic": "Statistic", + "thunder": "Thunder", + "water1": "Water 1", + "water2": "Water 2", + "win": "Win 1", + "win2": "Win 2", + "wind": "Wind", + "wind_short": "Wind short" + } + }, + "icon_type": { + "options": { + "none": "None", + "info": "Info", + "alert": "Alert" + } + }, + "priority": { + "options": { + "info": "Info", + "warning": "Warning", + "critical": "Critical" + } + } } }