Script Entity ID not Updating when Changed
Checklist
- [X] I have updated to the latest available Home Assistant version.
- [X] I have cleared the cache of my browser.
- [X] I have tried a different browser to see if it is related to my browser.
Describe the issue you are experiencing
If I create a script, rename the script entity id from the entities menu, the entity id is not renamed in the scripts.yaml.
The auto generator when you type will suggest the renamed entity_id and script name but it's not actually the correct entity id because when the script is called it says the script is not found.
Describe the behavior you expected
If a user renames a script entity_id from the entities page that it will update the script in scripts.yaml
Steps to reproduce the issue
- Create Script
- Change entity_id from entities page
- Attempt to use script from an automation or service call in developer tools.
- Check scripts.yaml and see the script entity_id never changed. ...
What version of Home Assistant Core has the issue?
2022.10.4
What was the last working version of Home Assistant Core?
No response
In which browser are you experiencing the issue with?
No response
Which operating system are you using to run this browser?
No response
State of relevant entities
I think this is expected behavior because it used to give an error when doing this but now it doesn't do the user assumes it actually changed the entity_id when it didn't.
Problem-relevant frontend configuration
new_script:
alias: Master Lights Script
sequence:
- service: light.turn_{{ set_light }}
target:
entity_id: '{{ target_lights }}'
data: '{{ light_setting }}'
mode: parallel
I renamed that entity_id only to find it was never renamed in scripts.yaml and only renamed in the frontend/entities page.
Javascript errors shown in your browser console/inspector
No response
Additional information
No response
Wanted to add to this, also experiencing the issue with 2022.11.1
Wanted to add to this, also experiencing the issue with 2022.11.1
Unfortunately... doesn't seem like anyone actually checks these.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Still ann issue.
Yep, still an issue.
Still an issue.
still an issue
I've the same issue on 2023.1.7!
Still an issue.
If a user renames a script entity_id from the entities page that it will update the script in scripts.yaml
I don't believe this is how its supposed to work. The scripts.yaml does not have an entity_id. The identifier for the script in scripts.yaml is the unique_id, and that does not change when you rename the entity id.
I agree that there is still some confusion as some places display the script unique_id, some display the entity_id, some display the friendly name. and some display the alias. But I can't find any thing that's actually broken.
Is there anywhere where something does not work because you renamed a script, or is the issue only that the name displayed in certain places is not as desired?
E.g. I create a script with the unique id: my_new_script_original_name, and an alias "My Script Alias"
my_new_script_original_name:
alias: My Script Alias
sequence: []
mode: single
The entity_id is originally script.<unique_id>, but it can be renamed. The friendly name is originally the script alias, but it can be renamed.
I can rename the entity_id to script.my_renamed_script. I can change the friendly name to My Script Friendly Name
devtools: showing entity id and friendly name
services picker: shows unique_id and friendly name
scripts tab: shows friendly name
script editor: shows alias
Have I missed anything? Or is the issue just that you want the services picker to show the renamed entity id instead of the unique_id?
If a user renames a script entity_id from the entities page that it will update the script in scripts.yaml
I don't believe this is how its supposed to work. The scripts.yaml does not have an entity_id. The identifier for the script in scripts.yaml is the unique_id, and that does not change when you rename the entity id.
I agree that there is still some confusion as some places display the script unique_id, some display the entity_id, some display the friendly name. and some display the alias. But I can't find any thing that's actually broken.
Is there anywhere where something does not work because you renamed a script, or is the issue only that the name displayed in certain places is not as desired?
E.g. I create a script with the unique id:
my_new_script_original_name, and an alias "My Script Alias"my_new_script_original_name: alias: My Script Alias sequence: [] mode: singleThe entity_id is originally script.<unique_id>, but it can be renamed. The friendly name is originally the script alias, but it can be renamed.
I can rename the entity_id to
script.my_renamed_script. I can change the friendly name toMy Script Friendly Namedevtools: showing entity id and friendly name
services picker: shows unique_id and friendly name
scripts tab: shows friendly name
script editor: shows alias
Have I missed anything? Or is the issue just that you want the services picker to show the renamed entity id instead of the unique_id?
Thank you for the response and I appreciate the work you're putting into the frontend.
I attached a video. If I edit the alias in the UI it updates the entity_id it will generate for the script. If I edit the alias in the script yaml it will not generate an entity_id and instead it's script.new_script do that 2 times and you will find you lost a script because it overwrote the previous one.
https://github.com/home-assistant/frontend/assets/47092714/1869f163-1152-4cb1-a065-d1200d409c74
Hmm I cannot reproduce any case where a script is "lost". If I do what you did (new script -> edit in yaml -> change alias -> save), I see new scripts added with some kind of unique # as their unique_id and entity_id. But I don't see anything being overwritten.
'1686107788648':
alias: foo
sequence: []
'1686107816319':
alias: bar
sequence: []
Nevertheless, is this a different issue than what you originally posted, which I think involved renaming the entity ids of existing scripts, not modifying the alias of new scripts?
Originally you mentioned:
when the script is called it says the script is not found
Do you have any examples of this? Also the videos are very helpful in showing which particular UI elements and fields you are referring to.
Hmm I cannot reproduce any case where a script is "lost". If I do what you did (new script -> edit in yaml -> change alias -> save), I see new scripts added with some kind of unique # as their unique_id and entity_id. But I don't see anything being overwritten.
'1686107788648': alias: foo sequence: [] '1686107816319': alias: bar sequence: []Nevertheless, is this a different issue than what you originally posted, which I think involved renaming the entity ids of existing scripts, not modifying the alias of new scripts?
Originally you mentioned:
when the script is called it says the script is not found
Do you have any examples of this? Also the videos are very helpful in showing which particular UI elements and fields you are referring to.
I guess the issue is fixed. I just checked and I saw that doesn't happen for me anymore. Previously this would result in test the first script being overwritten.
https://github.com/home-assistant/frontend/assets/47092714/e3817c4f-7861-4b95-be2c-51718b56088b
'1686134532780':
alias: Test
sequence: []
'1686134545845':
alias: Fooscript
sequence: []
when the script is called it says the script is not found This was happening because the friendly name was the alias but the entity_id was
script.new_script
@Daniel-dev22 , in what sense is this related or a duplicate of #17571. Is the issue fixed for you, as mentioned above, or is there a way to reproduce this given the steps in #17571?
@Daniel-dev22 , in what sense is this related or a duplicate of #17571. Is the issue fixed for you, as mentioned above, or is there a way to reproduce this given the steps in #17571?
Related in that there's issues with the Scripts UI resulting in bad entity IDs.
If I update the alias in yaml it does not update the script entity id. https://github.com/home-assistant/frontend/assets/47092714/6fd92996-0ffe-4286-b2b3-7798983f0bc3
If I update the alias in the UI it does update the script entity id. https://github.com/home-assistant/frontend/assets/47092714/fcd0bb1d-1748-43ce-aa4a-569724a80ed5
If a user renames a script entity_id from the entities page that it will update the script in scripts.yaml
I don't believe this is how its supposed to work. The scripts.yaml does not have an entity_id. The identifier for the script in scripts.yaml is the unique_id, and that does not change when you rename the entity id.
I agree that there is still some confusion as some places display the script unique_id, some display the entity_id, some display the friendly name. and some display the alias. But I can't find any thing that's actually broken.
Is there anywhere where something does not work because you renamed a script, or is the issue only that the name displayed in certain places is not as desired?
E.g. I create a script with the unique id:
my_new_script_original_name, and an alias "My Script Alias"my_new_script_original_name: alias: My Script Alias sequence: [] mode: singleThe entity_id is originally script.<unique_id>, but it can be renamed. The friendly name is originally the script alias, but it can be renamed.
I can rename the entity_id to
script.my_renamed_script. I can change the friendly name toMy Script Friendly Namedevtools: showing entity id and friendly name
services picker: shows unique_id and friendly name
scripts tab: shows friendly name
script editor: shows alias
Have I missed anything? Or is the issue just that you want the services picker to show the renamed entity id instead of the unique_id?
Ok, so the problem comes from the fact that the unique_id and the entity_id are very easy to be confused. I think both should be one and the same thing. Or, the unique_id should be editable. Or, if not, the entity_id should be displayed everywhere and I think this is the better solution.
I encountered this problem when selecting a widget on Android. There, the services picker shows just the unique_id, without any Aliases. I changed the entity_id and, not being aware of the difference between the unique and the entity id, I didn't know why the modified id wasn't appearing.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Not stale.
Still an issue.
+1
+1
Happening for me with latest HA OS. Just recently moved from a docker container to dedicated machine, this is the cause of a lot of teething problems copying automations over from my old install.
Still an issue. It makes me afraid to change entity_id at will.
This is still an issue.
Renamed script:
Broken automation because the automation is looking up the "unique_id" vs "entity_id":
scripts.yaml:
The "unique_id" needs to change when the "entity_id" does to eliminate the confusion.
To make things worse, it references the new entity_id when using yaml:
Home Assistant OS installed on barebones machine.
Core: 2024.4.3
Supervisor: 2024.04.0
Operating System: 12.2
Frontend: 20240404.2
EDIT: I would like to add the issue persists after a reboot of the OS and the entire machine.
EDIT2:
Updating the "unique_id" in scripts.yaml "fixes" the automation, but breaks the script:
I know I previously said I didn't think it was possible, but I did find a sequence of steps that allowed me to overwrite an existing script by creating a new one. I have filed the specific steps as a new issue #20777.
This still seems to be an issue. I don't know the circumstances but when I create a new script, save it and change its entity_id, I still see the old ID in the UI, when e.g. trying to use the script as an action. However, the Devices > Entity view shows the correct, new ID.
This still seems to be an issue. I don't know the circumstances but when I create a new script, save it and change its
entity_id, I still see the old ID in the UI, when e.g. trying to use the script as an action. However, theDevices>Entityview shows the correct, new ID.
Same here.
I see a discrepancy between the name of the service and the name of the entity. Looks like changing the id of the script changes only the name of the entity, but not of the service.
Which is odd in the UI, as you see the name and icon of the service and not the script entity.
still an issue today for me as well. Just migrated some services from scripts (yaml) and I just noticed the same - exactly as above. Took me a while to realise as it's only in the service tab the real script entity id is shown apparently - all other UI shows the updated name.
Does anyone know how to force-update (or which file to update to make this change permanent)?
for anyone else also having this issue - do you have a customize: !include customize.yaml or similar inside your configuration.yaml file? Could it be linked to this?
No includes here.
I got
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
But I'm 99% sure that's the baseline configuration.



