Physically replace failed device

Does Home Assisntant support “easy way” to replace failed device?
My Aqara Bulb (lamp) fails (was broken).
This device used in many scripts and scenes.
I bought new bulb.
Now i need to rewrite all the scripts with new device address?

Only if you used device triggers, conditions, or actions.

And you don’t have to re-write everything. You just need to change the old device id for the new one. Everywhere you used it.

A text editor with a good “find and replace” action should help with doing this.

In future only use entity_ids, not device ids. You can change the new entity_id to match the old one in one place.

Cool! Yes, i can.
Can my mom or grandma or “an ordinary citizen” do it?
Does HomeAssistans team have any plans to make this function user-friendly?

1 Like

I posted this 2 years ago:

There is also a related WTF post.

Due to the lack of movement on this I suggest your mom or grandma not use device automations as instructed above. Hopefully they should be able to change one entity id.

Where is entity_id ?

To change it, go to Settings → Devices & Services → Entities Tab.

Click on the entity. You can edit the entity id in the pop-up box.

This will not change other places that you have already used the entity id.

Hence it is only useful for making entity ids more understandable if you have not used them yet (do it soon after adding them), or for changing a new entity to match one that is no longer available.

What’s this?
I gave this name on the low-level (zigbee gateway).
And the gateway translate it to Home Assistant.
Can i use it in my scripts, triggers, … ?

It is the friendly name.

No you cant use it in your triggers. It has to be the entity_id or device_id.

You can edit this name to be something more meaningful to you in the same place I listed above. It can contain capital letters and spaces (the entity_id can not) to make it look pretty in your dashboard cards.

Hi, what about buttons as triggers? In my case button entity has no options to recognize single, double or long action. It this a case when a device must be used?

Use an event trigger. https://www.home-assistant.io/docs/automation/trigger/#event-trigger

Thanks a lot for your prompt response. I’m not sure if I followed it correctly, but the below configuration actually worked:

platform: state
entity_id:
  - sensor.btn_kitchen_desk_action
attribute: action
to: single
id: btn_kitchen_desk_single

The only inconvenience is that when editing in GUI, there is no hint on valid FROM / TO states. You must type “single” manually, while when using a device as a trigger the valid options are suggested by the GUI. It is intentional or maybe possible improvement?

That is a state trigger. Which I did not suggest because you said:

Clearly it does have this option.

Sorry for confusion, I’m just beginning my HA journey and do not recognize it all properly yet. I was mislead by the fact that when use state trigger its possible values are not suggested by the GUI - like they are when device trigger is used. Anyways, thanks for your help.