Skip to content

Renaming Script Entities does not rename script ID #124550

Description

@sam-ward

The problem

This may be expected behavior, but it caught me out today so I thought i'd log it. I went through the exercise today of migrating my scripts (and automations) from yaml files to the editor using the migrate button. The process was:

  1. Migrate the script, naming it the same as the old script (so it ends up with a _2 suffix).
  2. Delete the script from the manually maintained yaml file (not scripts.yaml).
  3. Using the Developer Tools -> YAML -> Reload Scripts.
  4. Using Settings -> Devices -> Entities screen to delete the orphaned script entity and change the entity ID of the new script entity to remove the _2 suffix

But what I found was that despite renaming the script, the script could only be referenced in an automation with its "original" old name (with the _2 suffix), and there didn't appear to be any mechanism to effect the rename as desired.

In the end to achieve the desired result I manually edited scripts.yaml file and changed (what I am assuming is) the script ID and used the developer tools to reload the scripts (in hind sight I could have also copied the script again to the desired name and deleted the _2 instance).

As I said i'm not sure if this is expected behavior, but it is certainly confusing behavior that you can not rename a script in-spite of the UI appearing to allow you to do so. Its also confusing because the same process does work on the automations.

What version of Home Assistant Core has the issue?

core-2024.8.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

script

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?

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions