Would be nice to have a way to easily add a device and say device.new replaces device.old
Kinda like find and replace in text editors
EXAMPLE 1 - Phones
I go buy a new phone.
I log in and setup new phone in HA app
I want to be able to have all notifications and location data that were on the old phone be changed to the new device
EXAMPLE 2 - locks
My lock broke
I buy new lock and setup in HA
I want this lock to replace the old lock everywhere in HA
In the UI
In my automations
I want the name in UI to remain but the underlying device it’s controlling to change to the new device
Front Door lock was Lock.old2012
Front Door lock is now lock.new2024
Definitely agreed. While it’s possible to change the Entity ID, you’d have to do that for (potentially) 10+ entities, and that doesn’t necessarily fix your automations if you use the “device” block instead of the “entity” block
These are not arguments against your WTH but only work-arounds for you to use until we get your requested functionality:
Use notification groups. That way you only have to change your phone in the one place, in the notification group. There are many posts about this on the forum.
Use entity ids not device ids in your automations. There’s a community guide about this.
Hopefully this makes your automating simpler until we get a way to easily replace a device.
I was tinkering with MQTT sensors, and I don’t know how or why, but HA created sensor.entitiy_2 from sensor.entitiy. I see no way to restore this, and therefore the history of this entity is split into 2 parts.
But yes, having an easy way to replace hardware, and have them continue producing data on existing entities would be heaven. Case in point: I use several Shelly plugs, and their energy data goes into the energy dashboard. I had two of them break and could see no easy way to do what I just described. Someone on a forum pointed out to me that I could delete the broken Shelly from the integration, and give the new one the same name. It worked, but I find that a very stressful way to do such a seemingly simple action.
Other example: I switched from a cloud-based integration to a local integration for my SolarEdge solar inverter. I could not find a way to have the local integration producy energy data on the old entity, so now I still have both entities in my energy dashboard; one dormant and one actively producing data. There is an ugly color switch if you look at a year.
Final example: in the beginning I didn’t know what I was doing with ESPHOME, and my water meter sensor gave me a lot of problems. Too make a long story short: after a lot of config tinkering in ESPHOME and 1 hardware replacement I have three water meter entities, two of them dormant and ont currently producing data. So if you look in my energy dashboard at the water section, you see three colours of blue, and if you look at the config page of the energy dasboard, it’s a nasty mess of sensors. I would like an easy way to merge all those dormant sensors into the current one.
I think it’s actually quite easy to replace a phone or any other device. Just give it the same name as the device you’re replacing.
Name your phone “Keiths Phone” instead of “Samsung S22”
Name your living room TV “Living Room TV” instead of “Sony Bravia 3”
Name your kitchen light “Kitchen Light” instead of “EcoDim BV Dimmer-Switch-ZB3.0”
etcetera
Then when you replace any device just remove the old one and give the new one the same name.
The entity id trick is a decent workaround in many cases. However, some devices (first type that comes to mind is zigbee wireless switches) don’t have entities that are useful in automations.
Buttons generate events. Which you can use (event trigger) instead of device triggers. Or they should have an associated binary_sensor you can use in a state trigger (easier).
Buttons or switches? What’s in a name? Many of the battery-powered devices with no physical switches in them have name that includes ‘switch’. I guess that is since for most users, a light switch is a button on the wall, not the thing that it operates. Just an example: Aqara Wireless Mini Switch - Aqara
The event triggers still include data that is specific to the device. At least in ZHA, it’s the device name or IEEE that identifies the device. So when you switch out the device you still need to change the automations, there’s no entity workaround. Here’s an example of a trigger event for one of my buttonswitchthingies:
Well, HA is just a small part of the world. To most people, a state is a part of a country.
Here’s the screenshot. I’m not sure what you want to see here, perhaps we’re drifting off topic a bit
Ah ok I seem to have mis-remembered. I thought binary sensors were created. But they are event entities. Which I would still expect to have seen on that page.
Can you check Developer Tools → States and search for "event. " (including the period). See if your button creates any event entities.
Well you are in that small part now. There is no escape. Best to learn the lingo.
Nope. I don’t use Zigbee2MQTT but I think that does make entities for some of these devices? Or maybe one of the other integrations that can deal with buttons? But not ZHA for as far as I have seen.
I know the lingo when it comes to the HA domains. But I was talking about the physical devices. A switch in HA is not a device, and neither is a button. I’m not sure where this dicussion is supposed to lead. I don’t have a question.