Okay please re open Add a method of replacing devices
You linked to this topic. It is open.
Sorry
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.
When adding a new device it would be cool to override the old device and or have the option to delete the old ones from your devices and entities. For example, I get a new phone but I cant just integrate it directly to my automations unless I delete or rename my old phones entities first. Another example would be if you change our your light switches from different brands you have to currently modify entity names and or automations
This is the one feature I really miss from hubitat, easy device swap.
Hi,
An easy task for a programmer, and a hard task for a frontend newbie. So IMHO a must have, if more people should be able to use HA.
Juergen
I used this in Hubitat so often when needing to switch devices out. Surely it couldn’t be that hard. A find and replace script? If I knew programming I would love to tackle this… but I don’t
Is there any news about it? In fact, a device has died and I have to replace it.
Same here…its a real drag when devices just die and need replacing.
Somewhat surprised this is not being asked for by more users of HA.
I’m evaluating home assistant since a day, trying to move out of jeedom. That feature is really flagged as MUST HAVE in my list.
I’m surprised it’s not there day 1. Does it really need a vote?
I have more 15 years of experience and yeah devices die . So I used a lot that feature from jeedom. Pick device Y, says this replace device X and all scripts/automations related to X are updated automatically from X to Y. No question.
Optionally you can ask to copy history from X to Y as an additional step.
Extremely convenient
Will wait for that feature before switching.
BTW home assistant seems brilliant. Great work!
I thought I would share my experiences:
For years I thought I’m doing something wrong.
Yesterday I replaced one device that is esphome so I have full control over it, created it from the template of the one that broke, HA still created new entities for everything. But device name is the same.
In this case I created entities in yaml, that just map the entities from device in case I would replace it.
“Firmware update” entity name cannot be renamed to the original one, but I do not use that anywhere.
Since I found the only working way would be to replace entity names.
I do have some devices that I know will die rather quickly, but are cheap and I do not know of better alternatives for my use - xiaomi bthome thermometers, for those I would like the statistics, until now I just went to database, exported it or created query that would calculate result for multiple entity names together - not really user friendly.
Now I find out that the way to go is:
- add new device - use whatever name
- copy entity name of the old device to notepad (etc.)
- rename entity names of the old device to ie. “_old”
- rename entities of the new device to the entities without “_old”
- verify everything is working - can take hours for energy dashboard
- delete old device
I will not comment on the user friendlies or confusion this caused for me, but I will ask one question:
what if I do want to rename entity name and keep it’s statistics data? Ie. when I do tiding up? Does it need to be manually changed in the database?
I do understand this is probably not the intended use for home assistant and I should use something like influx or whatnot for the statistics, so this is not the priority for the devs as it is not automation. But maybe now with energy dashboard it does make it more in line with HA primary uses?
If you rename entities, the database goes with it. In your process listed above, you’d lose history. If you follow this process, you’ll keep the history.
- delete old device
- add new device - use entity_id’s of old device entity_ids
You’ll need to update automations if you’re using device triggers, actions, or conditions.
It will NOT loose history
Why do you think so?
Because that is what I did.
Sorry, but you must have done something in a different order. I’m speaking from how the code works, not from hunches.
When you change an entity_id in the system, the history will follow that entity. If you follow your path above, you will lose the history because you started by renaming the entity_id.
Here’s a post I made awhile ago that highlights the path you should take to replace entities and keep history:
Every time when I renamed device or entity, I did lost it’s history. If I rename new to the same name (id) as the one that existed before, history is kept.
It is not that hard to replicate.
Are you running an older version of HA? If yes, that’s why. History following entities was added about a year ago.
Post a video then please. Make sure you refresh your page after you rename, it takes a moment for everything to process.
The ui still seems to favour device IDs?
Maybe that’s just me?
Also realize this is probably a very niche case. But I just put a new IKEA bulb in one of my outside lights. Named it. Added it to a group, gave it it’s own dashboard button and set up a ZigBee light switch.
Then realised it has variable colour temperature, the one in my bedroom does not. I’d love to swap them but setting both up from scratch again doesn’t seem worth it.