From a7e5533d53a3786686d1deb616c2cfaf7c9694f0 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 12 Jul 2023 09:03:01 +0200 Subject: [PATCH 1/2] Migrate scene services to support translations --- homeassistant/components/scene/services.yaml | 23 --------- homeassistant/components/scene/strings.json | 52 +++++++++++++++++++- 2 files changed, 51 insertions(+), 24 deletions(-) diff --git a/homeassistant/components/scene/services.yaml b/homeassistant/components/scene/services.yaml index 202b4a98aa946..acd98b102553a 100644 --- a/homeassistant/components/scene/services.yaml +++ b/homeassistant/components/scene/services.yaml @@ -1,16 +1,11 @@ # Describes the format for available scene services turn_on: - name: Activate - description: Activate a scene. target: entity: domain: scene fields: transition: - name: Transition - description: Transition duration it takes to bring devices to the state - defined in the scene. selector: number: min: 0 @@ -18,16 +13,9 @@ turn_on: unit_of_measurement: seconds reload: - name: Reload - description: Reload the scene configuration. - apply: - name: Apply - description: Activate a scene with configuration. fields: entities: - name: Entities state - description: The entities and the state that they need to be. required: true example: | light.kitchen: "on" @@ -37,9 +25,6 @@ apply: selector: object: transition: - name: Transition - description: Transition duration it takes to bring devices to the state - defined in the scene. selector: number: min: 0 @@ -47,19 +32,13 @@ apply: unit_of_measurement: seconds create: - name: Create - description: Creates a new scene. fields: scene_id: - name: Scene entity ID - description: The entity_id of the new scene. required: true example: all_lights selector: text: entities: - name: Entities state - description: The entities to control with the scene. example: | light.tv_back_light: "on" light.ceiling: @@ -68,8 +47,6 @@ create: selector: object: snapshot_entities: - name: Snapshot entities - description: The entities of which a snapshot is to be taken example: | - light.ceiling - light.kitchen diff --git a/homeassistant/components/scene/strings.json b/homeassistant/components/scene/strings.json index c92838ea322f7..9ec05b181a3f1 100644 --- a/homeassistant/components/scene/strings.json +++ b/homeassistant/components/scene/strings.json @@ -1 +1,51 @@ -{ "title": "Scene" } +{ + "title": "Scene", + "services": { + "turn_on": { + "name": "Activate", + "description": "Activates a scene.", + "fields": { + "transition": { + "name": "Transition", + "description": "Transition duration it takes to bring devices to the state defined in the scene." + } + } + }, + "reload": { + "name": "Reload", + "description": "Reloads scenes from the YAML-configuration." + }, + "apply": { + "name": "Apply", + "description": "Activates a scene with configuration.", + "fields": { + "entities": { + "name": "Entities state", + "description": "The entities and the state that they need to be." + }, + "transition": { + "name": "Transition", + "description": "Transition duration it takes to bring devices to the state defined in the scene." + } + } + }, + "create": { + "name": "Create", + "description": "Creates a new scene.", + "fields": { + "scene_id": { + "name": "Scene entity ID", + "description": "The entity_id of the new scene." + }, + "entities": { + "name": "Entities state", + "description": "The entities to control with the scene." + }, + "snapshot_entities": { + "name": "Snapshot entities", + "description": "The entities of which a snapshot is to be taken." + } + } + } + } +} From 61a47f69c342e8b99116912495822dfba946dbb4 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 12 Jul 2023 09:50:46 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com> --- homeassistant/components/scene/strings.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/scene/strings.json b/homeassistant/components/scene/strings.json index 9ec05b181a3f1..f4011860c785c 100644 --- a/homeassistant/components/scene/strings.json +++ b/homeassistant/components/scene/strings.json @@ -7,13 +7,13 @@ "fields": { "transition": { "name": "Transition", - "description": "Transition duration it takes to bring devices to the state defined in the scene." + "description": "Time it takes the devices to transition into the states defined in the scene." } } }, "reload": { "name": "Reload", - "description": "Reloads scenes from the YAML-configuration." + "description": "Reloads the scenes from the YAML-configuration." }, "apply": { "name": "Apply", @@ -21,11 +21,11 @@ "fields": { "entities": { "name": "Entities state", - "description": "The entities and the state that they need to be." + "description": "List of entities and their target state." }, "transition": { "name": "Transition", - "description": "Transition duration it takes to bring devices to the state defined in the scene." + "description": "Time it takes the devices to transition into the states defined in the scene." } } }, @@ -35,15 +35,15 @@ "fields": { "scene_id": { "name": "Scene entity ID", - "description": "The entity_id of the new scene." + "description": "The entity ID of the new scene." }, "entities": { "name": "Entities state", - "description": "The entities to control with the scene." + "description": "List of entities and their target state. If your entities are already in the target state right now, use `snapshot_entities` instead." }, "snapshot_entities": { "name": "Snapshot entities", - "description": "The entities of which a snapshot is to be taken." + "description": "List of entities to be included in the snapshot. By taking a snapshot, you record the current state of those entities. If you do not want to use the current state of all your entities for this scene, you can combine the `snapshot_entities` with `entities`." } } }