From e90967d2007eee3ee773955530e7aa5e8dbae38a Mon Sep 17 00:00:00 2001 From: Said Tahsin Dane Date: Sun, 27 Apr 2025 18:17:55 +0200 Subject: [PATCH] Scripts - Fix the run button to check if the script has fields (#25156) * Fix the run button to check if the script has fields * Used a more straightforward function to check fields instead of an async call --- src/panels/config/script/ha-script-picker.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/panels/config/script/ha-script-picker.ts b/src/panels/config/script/ha-script-picker.ts index 075addce47..ef32f99ad7 100644 --- a/src/panels/config/script/ha-script-picker.ts +++ b/src/panels/config/script/ha-script-picker.ts @@ -86,6 +86,7 @@ import { deleteScript, fetchScriptFileConfig, getScriptStateConfig, + hasScriptFields, showScriptEditor, triggerScript, } from "../../../data/script"; @@ -1068,12 +1069,17 @@ ${rejected if (!entry) { return; } - await triggerScript(this.hass, entry.unique_id); - showToast(this, { - message: this.hass.localize("ui.notification_toast.triggered", { - name: computeStateName(script), - }), - }); + + if (hasScriptFields(this.hass, entry.unique_id)) { + this._showInfo(script); + } else { + await triggerScript(this.hass, entry.unique_id); + showToast(this, { + message: this.hass.localize("ui.notification_toast.triggered", { + name: computeStateName(script), + }), + }); + } }; private _showInfo(script: any) {