frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Script Entity ID not Updating when Changed

Open Daniel-dev22 opened this issue 3 years ago • 57 comments

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

  1. Create Script
  2. Change entity_id from entities page
  3. Attempt to use script from an automation or service call in developer tools.
  4. 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

Daniel-dev22 avatar Oct 20 '22 14:10 Daniel-dev22

Wanted to add to this, also experiencing the issue with 2022.11.1

Jeepmb avatar Nov 12 '22 15:11 Jeepmb

Wanted to add to this, also experiencing the issue with 2022.11.1

Unfortunately... doesn't seem like anyone actually checks these.

Daniel-dev22 avatar Nov 12 '22 16:11 Daniel-dev22

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.

github-actions[bot] avatar Feb 10 '23 17:02 github-actions[bot]

Still ann issue.

Daniel-dev22 avatar Feb 10 '23 17:02 Daniel-dev22

Yep, still an issue.

hawkseye76 avatar Mar 06 '23 22:03 hawkseye76

Still an issue.

larserikalexander avatar Apr 25 '23 18:04 larserikalexander

still an issue

mvanlijden avatar May 26 '23 12:05 mvanlijden

I've the same issue on 2023.1.7!

domibarton avatar May 26 '23 21:05 domibarton

Still an issue.

kasperschnack avatar Jun 06 '23 21:06 kasperschnack

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 image

services picker: shows unique_id and friendly name image

scripts tab: shows friendly name image

script editor: shows alias image

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?

karwosts avatar Jun 07 '23 01:06 karwosts

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 image

services picker: shows unique_id and friendly name image

scripts tab: shows friendly name image

script editor: shows alias image

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

Daniel-dev22 avatar Jun 07 '23 01:06 Daniel-dev22

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.

karwosts avatar Jun 07 '23 03:06 karwosts

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 avatar Jun 07 '23 10:06 Daniel-dev22

@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?

silamon avatar Aug 18 '23 18:08 silamon

@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

Daniel-dev22 avatar Aug 21 '23 14:08 Daniel-dev22

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 image

services picker: shows unique_id and friendly name image

scripts tab: shows friendly name image

script editor: shows alias image

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.

george9816 avatar Oct 10 '23 13:10 george9816

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.

github-actions[bot] avatar Jan 08 '24 15:01 github-actions[bot]

Not stale.

Daniel-dev22 avatar Jan 08 '24 15:01 Daniel-dev22

Still an issue.

rhmunich avatar Jan 22 '24 19:01 rhmunich

+1

PineappleEmperor avatar Jan 23 '24 19:01 PineappleEmperor

+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.

goodlucknow avatar Feb 09 '24 23:02 goodlucknow

Still an issue. It makes me afraid to change entity_id at will.

dylango avatar Mar 15 '24 15:03 dylango

This is still an issue.

Renamed script: entity_id_01

Broken automation because the automation is looking up the "unique_id" vs "entity_id": entity_id_02

scripts.yaml: entity_id_03

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: entity_id_04

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: entity_id_08 entity_id_05 entity_id_06 entity_id_07

justinmyersm avatar Apr 12 '24 14:04 justinmyersm

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.

karwosts avatar May 11 '24 15:05 karwosts

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.

lukasmalkmus avatar Jun 25 '24 07:06 lukasmalkmus

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.

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.

masi avatar Jun 28 '24 09:06 masi

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)?

ulnic avatar Jul 12 '24 07:07 ulnic

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?

ulnic avatar Jul 12 '24 08:07 ulnic

No includes here.

vilhalmer avatar Jul 12 '24 13:07 vilhalmer

I got

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

But I'm 99% sure that's the baseline configuration.

lukasmalkmus avatar Jul 12 '24 16:07 lukasmalkmus