From 2550bff4e9954510e11f74b734cf9996d30228e4 Mon Sep 17 00:00:00 2001
From: karwosts <32912880+karwosts@users.noreply.github.com>
Date: Mon, 2 Dec 2024 02:18:03 -0800
Subject: [PATCH] Init new scenes in live edit mode (#23051)
* Init new scenes in live edit mode
* Update src/panels/config/scene/ha-scene-editor.ts
Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
* imports
---------
Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
---
src/panels/config/scene/ha-scene-editor.ts | 23 +++++++++++++++++++---
src/translations/en.json | 8 ++++----
2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/src/panels/config/scene/ha-scene-editor.ts b/src/panels/config/scene/ha-scene-editor.ts
index 80b6a97918..5dce2d4577 100644
--- a/src/panels/config/scene/ha-scene-editor.ts
+++ b/src/panels/config/scene/ha-scene-editor.ts
@@ -7,7 +7,9 @@ import {
mdiContentSave,
mdiDelete,
mdiDotsVertical,
+ mdiEye,
mdiInformationOutline,
+ mdiMotionPlayOutline,
mdiPlay,
mdiTag,
} from "@mdi/js";
@@ -204,6 +206,14 @@ export class HaSceneEditor extends SubscribeMixin(
}
);
+ public connectedCallback() {
+ super.connectedCallback();
+ if (!this.sceneId) {
+ this._mode = "live";
+ this._subscribeEvents();
+ }
+ }
+
public disconnectedCallback() {
super.disconnectedCallback();
if (this._unsubscribeEvents) {
@@ -387,15 +397,22 @@ export class HaSceneEditor extends SubscribeMixin(
alert-type="info"
.narrow=${this.narrow}
.title=${this.hass.localize(
- `ui.panel.config.scene.editor.${this._mode === "live" ? "live_preview" : "review_mode"}`
+ `ui.panel.config.scene.editor.${this._mode === "live" ? "live_edit" : "review_mode"}`
)}
>
${this.hass.localize(
- `ui.panel.config.scene.editor.${this._mode === "live" ? "live_preview_detail" : "review_mode_detail"}`
+ `ui.panel.config.scene.editor.${this._mode === "live" ? "live_edit_detail" : "review_mode_detail"}`
)}
+
+
+
${this.hass.localize(
- `ui.panel.config.scene.editor.${this._mode === "live" ? "back_to_review_mode" : "live_preview"}`
+ `ui.panel.config.scene.editor.${this._mode === "live" ? "switch_to_review_mode" : "live_edit"}`
)}
diff --git a/src/translations/en.json b/src/translations/en.json
index 8069cf58ad..20018575bd 100644
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -3878,11 +3878,11 @@
},
"editor": {
"review_mode": "Review Mode",
- "review_mode_detail": "You can adjust the scene's details and remove devices or entities. To fully edit, switch to Live Preview, which will apply the scene.",
- "live_preview": "Live Preview",
- "live_preview_detail": "In Live Preview, all changes to this scene are applied in real-time to your devices and entities.",
+ "review_mode_detail": "You can adjust the scene's details and remove devices or entities. To fully edit, switch to Live Edit, which will apply the scene.",
+ "live_edit": "Live Edit",
+ "live_edit_detail": "In Live Edit, all changes to this scene are applied in real-time to your devices and entities.",
"enter_live_mode_unsaved": "You have unsaved changes to this scene. Continuing to live preview will apply the saved scene, which may overwrite your unsaved changes. Consider if you would like to save the scene first before activating it.",
- "back_to_review_mode": "Back to review mode",
+ "switch_to_review_mode": "Switch to review mode",
"default_name": "New scene",
"load_error_not_editable": "Only scenes in scenes.yaml are editable.",
"load_error_unknown": "Error loading scene ({err_no}).",