Open rrooggiieerr opened 4 months ago
Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (script
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
script documentation script source (message by IssueLinks)
I think script.something isn't a valid service. Don't you have to run script.turn_on and pass the script as parameter?
@joostlek script.something
is valid, give it a try.
It's actually different behaviour. Using script.something
in an automation waits for the script to be finished while script.turn_on
starts the script and then immediately continues the automation.
https://www.home-assistant.io/integrations/script/#waiting-for-script-to-complete "When calling a script “directly” (e.g., script.NAME) the calling script will wait for the called script to finish. If any errors occur that cause the called script to abort, the calling script will be aborted as well."
Confirm exactly what the OP describes. And it raises serious issues. The use of "service: script.something" becomes impossible, though it is widely used in dashboards, for example.
I noticed this issue a few days ago and raised it in the community before I found this Github issue: https://community.home-assistant.io/t/rename-service-script/717374/3
There's a temporary "solution" for this until it gets resolved, you can fix the name in the scripts.yaml
file directly. To access and edit the file, I used the VSCode web addon to edit the file from within the Home Assistant web UI: https://github.com/hassio-addons/addon-vscode/blob/main/vscode/DOCS.md
When you open the scripts.yaml
file you'll see the OLD name in there, you can just update it to the new name, save the file, and then restart Home Assistant (check the config first to make sure it's all ok!).
Now the "service' shows correctly for me everywhere.
I found a while after that this caused some issues where the script wasn't recognised in some places, I've changed it back to how it was before for now.
Instead of editing the scripts.yaml
just duplicate the automation, give the duplicate the name you want and delete the original
The problem is not in how to find a workaround, I believe everybody found something for the their particular case. The problem is that there was a particular algorithm for naming scripts that was working perfectly and now it is broken with an update.
A script is also a service. And from the UI only the id of the entity is changed.
What I would expect is that for scripts the service id changes with the entity id. I assume that the UI will need a dedicated rename dialogue to perform this behaviour.
Is no one looking to fix the "Rename" issue? I'm now stuck trying to find where the old scripts are defined, as it keeps NUMBERING my script every time I recreate it.
I think @home-assistant/core should be involved
I think @home-assistant/core should be involved
How can the core devs be reached? For some integrations a bot pings some of them. Apparently not for scripts.
The problem
When renaming the Entity ID of a script things go wonky.
The Entity ID is renamed in the entities and scripts overview, but when calling the script from an automation, the frontend or Developer Tools > Services the new Entity ID does not work, but the old one still needs to be used.
Example:
I renamed the Entity ID of my script from
script.boiler_45_min
toscript.prepare_shower
Using the new Entity ID from the frontend gives an error:
https://github.com/home-assistant/core/assets/18603534/a9b2f8d0-c4ca-4f87-83d9-da809a8287b8
Calling my script in Developer Tools > Services still shows the old Entity ID:
The new id does not work in Developer Tools > Services even though in YAML mode command completion suggests the new Entity ID:
Running the script from the Scripts overview does work.
Workaround: Duplicate the automation, give the duplicate the name you want and delete the original
What version of Home Assistant Core has the issue?
core-2024.4.2
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Scripts
Link to integration documentation on our website
https://www.home-assistant.io/integrations/script/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
No response