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
pull/24917/head^2
Said Tahsin Dane 2025-04-27 18:17:55 +02:00 committed by GitHub
parent 631bfe46ba
commit e90967d200
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 6 deletions

View File

@ -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) {