Device Swapper

Easter? Mothers Day? It seems like every holiday lately has had a sale!

3 Likes

@bravenel thanks for the development on this. I appreciate it's been a difficult job for you, however it's a game changer for the community. This type of support is exactly why Hubitat differs from the lesser hubs in the market. Awesome!!!!

EDIT, also this is one of two enhancements I've requested. The other being "random" being available as a "delay" when turning a switch on.

Outstanding and thanks for listening to your members :smiley::+1::+1::+1:

7 Likes

The devices that are available to swap in the new Device Swap feature don't include many of my devices. For example none of my LIFX bulbs, Groups and Scenes groups, or Kasa switches are listed. Is the device swap feature limited to certain types of devices?

It doesn't work with child devices.

That's unfortunate. Any chance it can be made to work with child devices in the future?

Unlikely. Child devices have intimate relationships with their parent app or driver, often with aspects of the parent app's or driver's reference to its child devices deeply embedded in its own data structures.

I see. That does make sense.

Did you ever get around to trying this? This would be helpful to know if this works for a C4->C7 migration.

Not yet, I purchased the C7 already but by health issues I been with no good mood to do it, I hope to do it soon, sorry.

1 Like

Sorry to hear that. Hope you feel better soon.

2 Likes

I certainly see that being an issue if you do anything for the driver or the app controlling that device. For other apps, though, it seems like one Presence Sensor should be equivalent to another, etc. Obviously that's a naive take, but I'd love to understand the complexity here.

If you skipped the parent device (and its parent app, if any), wouldn't references from any other app just work most of the time? Can Hubitat know which devices are accessed by being selected from an Input and swap those? In those cases, you could even know which capability was being selected for, though I don't know if that's retained, and check that the new device shares that capability.

Even something that gets us most of the way there would still be a huge help. I'd rather clean up leftovers than do the whole thing manually.

Having spent the entire week converting a single driver into Parent/Child, I can only reiterate what @bravenel said.

Each child has to pass unique data to the Parent, and the Parent has to retain it, individually. There isn't any guideline for that, thus any attempt to swap the child will break the interrelationship. The data structure I picked is unique to this one driver.

3 Likes

This is basically saying that you are willing to put up with a broken hub; but it could indeed be broken, irretrievably so (I know from first hand experience, as I did this to my own hub during development -- it's not good and very difficult to unwind). As @csteele observes, there is a unique driver/app relationship between parent and child device -- one that cannot be discerned externally. There is no way for the hub to know which are ok to swap and which are not, or under what circumstances -- which might be harmless and which would bring things down. It just isn't possible to go down the path you are suggesting, nor advisable under any circumstances. In other words, it won't happen.

4 Likes

Hope it's ok to hop onto this thread. I want to do a straight swap between two smart plugs that both already are used in rules etc, so plug 1 will do plug 2's tasks and vice versa. All apps they are involved in just use their on/off states so any small differences between them won't matter. I was thinking of a 3-way rotational shuffle with a virtual switch placeholder, but I am doubting myself and thinking I might need two virtuals placeholders to avoid losing anything.

Pair the new device. Simply open the app.. Pick the old device and then the new device you want to swap it with. Then when done remove the old device. No need to add a 3rd step.

1 Like

By The Way: This is the coolest feature EVER introduced...

3 Likes

That's exactly what I do. Not too bad once you get used to it. Device replace is supposed to have this effect but I've never been able to get it to work.

Ive done it the exact same thing in the past with a 3 WAY swap. It does work as you'd expect. No need to fear