I'm experiencing an issue with the Device Swap feature that's leaving my system in an inconsistent state.
I have two Zigbee outlet switches, both using the Generic Zigbee Outlet driver. One has power metering capability, the other doesn't. I physically swapped their locations because I needed power metering in a different location. After the physical swap, I used Settings → Swap Device to swap the two devices.
The swap appears to have only partially completed. When I control "Device A" from Home Assistant or Alexa, the correct physical device responds. However, when I control "Device A" from the Hubitat web GUI or WebCoRE, the wrong physical device responds - the one that should be Device B. This means different systems think "Device A" refers to different physical hardware.
I've tried rebooting the hub and hard refreshing my browser, but the condition persists. Both devices are Zigbee outlets using the Generic Zigbee Outlet driver. Neither are child devices. I'm running a C-7 hub on firmware 2.4.3.173.
This seems like the exact use case the swap feature was designed for, so I'm hoping there's a way to complete the swap or fix the inconsistent state without manually rebuilding all my automations and dashboards.
The device detail page is the authoritative source. It's likely this is what you mean when you say "web GUI," but it would be good to confirm this as opposed to something else possibly confounding like a dashboard.
Is it possible you just never swapped the names? The device swap basically just swaps the device IDs in the database. If it works, it's pretty much impossible for any app to know the difference. But it swaps everything, including the new device taking the name of the "old" one. The fact that Alexa behaves differently probably just means it never got the new name. You'll have to go in and hit "Done" in the integration app on Hubitat (and make sure only the device you actually want, the one that responds, is selected and that you don't end up with duplicates in Alexa when all is done), or maybe you already did this before the swap but after adding the new device?
I tested on the Commands tab for the device in the Hubitat web interface. After the swap using the Commands tab for Device A, it turns on Device A, incorrect behavior, as if the swap didn't do anything. If I ask Alexa or HA to turn on Device A, it turns on Device B, correct behavior, devices are swapped.
That's the first question, but there are more. I'd read the rest of my post and see if any applies.
Adding to that, if any device is not "In use by" (check that tab on its device detail page) the Alexa integration, it's impossible for Alexa to be controlling that device. This would further suggest it's just a naming issue.
Does one single device have "In use by" with the apps you expect and the other have nothing? And is the device with nothing the one no longer controllable from the device detail page? That's the outcome you want. You can then swap the names if that's all that remains. I'd clear that all up first, but you can remove the non-functional, non-in-use-by device when done to reduce confusion once that's sorted out.
Keep in mind that any device detail pages you had open before the swap will not dynamically refresh; they'd need to be reloaded to see that they are now the "new" (or "old") device.
Finally, if you don't think it worked, I suppose you could just try it again -- worst case is you're back to where you started if it did. But I suspect it's one or more of the above, alone or in combination, making things look weird.
PS - You're correct that the tool was designed for this kind of use case, so it should work. But the "Replace" option at the end of the "Add Device" wizard is even easier next time! It does the same for you and puts "(old)" at the end of the old device name and gives the new device the same name as the old one, so you don't have to worry about at least one of the above.
1 Like
Before swap:
Device A (67) Network Id 21A7 Zigbee Id 5C0272FFFECEA4EB in use by WebCoRE piston A
Device B (261) Network Id 58DD Zigbee Id 282C02BFFFE8BE05 in use by WebCoRE piston B
Toggling Device A from HE, HA, Alexa or WebCoRE toggles Device A
After swap:
Device A (261) Network Id 21A7 Zigbee Id 5C0272FFFECEA4EB in use by WebCoRE piston B
Device B (67) Network Id 58DD Zigbee Id 282C02BFFFE8BE05 in use by WebCoRE piston A
Toggling Device A from HA, Alexa or WebCoRE toggles Device B
Toggling Device A from HE toggles Device A
So, contrary to my earlier report, everything is swapped except for the HE web GUI.
You asked, "Is it possible you just never swapped the names?"
No, I did not rename the devices. I assumed that was part of what the swap function did. But now I have gone into the Device Info tab in HE and renamed them. Now everything seems to be as it should be. I guess it's a two-step process for what I was using the swap function for.