Add a method of replacing devices

Automations associated with a device are marked as unavailable if you replace that device if it is faulty/stolen etc…

For state automations you just name the new entity_id the same as the old and… you’re done.

For device automations you have to search out all the occurrences of the old device_id and replace them with the new one. You cant just edit the new device id to be the same as the old one.

For people only using the UI this is daunting task and they would probably end up re-writing all their ‘missing’ automations.

A mechanism to replace a device is needed.

1 year later, anyone has a clue if this is picked up?

Also gains some additional importance with the addition of the energy dashboard. Replacing a plug leaves one with the choice of either keeping the old plug in tracking or just losing the consumption data.

1 Like

energy dashboard is based on entities. You can swap them out pretty easily. Integrate the new device. Rename the old device entity_id’s to something else. Rename the new device entity_id to what the old entity_id’s were. Delete the old device. Restart. It’s not perfect but it’s something you can do right now while waiting for an easier method.

That will work for automations, but not for statistics.

That will work for statistics too

A button in the automations page to batch replace all devices with entities would be perfect.


Device Replacement (swap out) Wizard

PROBLEM: Light bulbs burn out. Switches and sensors break. I buy a new cell phone every few years!

SOLUTION: I want a wizard to replace an existing sensor with another one. The wizard needs to update / edit the exiting automations. It should replace the old device references / usage inside automations with the new device.

E.G. I have a rule turning a light bulb on 1/2 hour before sun-set. The light bulb dies. I buy a replacement. I want a way to replace / swap / exchange at the device level. This should;

  1. New wizard asks to backup the system.
  2. New wizard shows you a list of all automations it will update. It asks — Should I continue replacing old device name with new device name? [Y/N]
  3. Put the new device into the same room as the old device
  4. Update all existing automations to use the new device
  5. Remove the old device from automation.
  6. Move the old device to “unassigned” room.
  7. Bonus Points: HA asks the admin — Should Home Assistant delete device? [Y/N]
  8. Bonus Points: Rename new device name to the old device name

Having had to replace a device or two lately, I would love if there was a much easier way to do it. Any updates on this?

Nope. Only this informal advice: Why and how to avoid device_ids in automations and scripts

Sounds as if you’re using device ids in automations - could I ask why? Genuine question - a lot of people do and I must be missing something because I just don’t see the advantage (except maybe for physical buttons).

Honestly been using HA for 3 weeks. Don’t know if there is any alternative… My guess is lack of knowledge. What is your suggestion for device ID alternatives?

Entity states. Why have this:

  - type: battery_level
    platform: device
    device_id: 16fbcd84302f4606819c58559aa90c82
    entity_id: 6c2e634686ebe58e571fefcdd6474f22
    domain: sensor
    below: 20

When you could have this:

  - platform: numeric_state
    entity_id: sensor.mobile_battery_level
    below: "20"

There’s a community guide about it.

You are right. I am using entity_id: sensor.airvisual_pro_619s_carbon_dioxide it was something like sensor.airvisual_pro_mainflo_carbon_dioxide. Again, I would like a global search and replace for the old / new device

Then start your own feature request because that is not what this one is about.

That already exists in the VSCode addon.

Okay please re open Add a method of replacing devices

1 Like

You linked to this topic. It is open.

Sorry :blush:

Tom was referring to opening a feature requrest for this phrase

which is an entity, not device. EDIT: Didn’t mean to increase the size of this text.

Your other FR is a duplicate of this FR. Please understand the distinction. Entities are not the same as devices.

1 Like