Swap Apps Device in Settings

I have a number of devices that are in use by several apps in both RM5.1, RM5.0 and RM Legacy. I am in the process of testing some alternative devices which I would like to replace (either temporarily or permanently) some existing devices with, in my RM rules. I noticed a Swap Apps Device function in the hub settings and was wondering if simply swapping these devices using this function would successfully swap the devices in all the iterations of RM while keeping the rest of the RM rule intact? If so, specifically, will this work in all versions of RM? I would like to avoid cloning all the rules then manually replacing each use instance of the devices in each rule. TIA for any information.

I haven't heard of it NOT working on a certain RM version. In theory, it completely switches out one device for another.

If you value those RM1.5 rules, I would be sure you had a current hub backup before doing a lot of switching stuff around as there really isn't a way to make a new RM1.5 rule IF for some reason it would be corrupted. Not that I think that will happen, but I am not sure anyone tested anything that old in Beta.

Congrats BTW for having a rule that old!

1 Like

Thanks for the info @neonturbo. However, I cannot take any credit for having a RM 1.5 rule, lol. I have RM 5.1 rules, RM5.0 rules, and RM legacy rules (RM4.1 and RM4.0 rules). I have only been using Hubitat for about 1 1/2 years now (was my Covid project).

I swear I read that earlier tonight and just now and both times I saw 1.5.

I must be going
:crazy_face:

LOL.

With these newer rule versions, you shouldn't have any issues at all.

"Swap Apps Devices" works by swapping one device's hub/database-assigned ID with that of another. (By this, I mean the number you see in the URL but not really anywhere in the UI; thisis is distinct from the Device Network ID.) There's nothing a specific app should need to do when this happens, nor would most apps really need to know or care (except as below), whether rules or other apps. If you think you notice something, I suggest reporting it so it can be investigated. But I don't see any issues with this.

The exception, of course, is when the devices aren't exactly the same and one app depends on a capability, command, or attribute that one device/driver may expose while another doesn't. This is the same pickle you can get yourself into if we leave the new "swap" feature out of the picture and, say, just change the driver on the device yourself. You'd want to be certain the devices are either truly the same (e.g., same driver) or at least implement the same capabilities or the specific one(s) you need for the app(s) that are using them.

Also, for the Hubitat historians, I think the first version of Rule Machine for Hubitat just created "Rule" apps, presumably implicitly something like 2.0; then the one after was "Rule 2.5." The 1.x versions were presumably just on SmartThings. :smiley: (But that history I don't remember as well...)

2 Likes

Thanks @bertabcd1234 ,
Makes complete sense. Iā€™m replacing some cameras that are linked via my Camect hub so the Camect Connect HE app will create virtual devices which should have the same attributes as the virtual camera devices I am replacing. So I do not anticipate any probems. My main concern was that since these devices are used by several different versions on RM, I just wanted to make sure that they would be replaced in all my RM rules, regardless of RM version number. Thanks for everyone for your quick responses. Coming over from other home automation systems, my experience with HE due in large part to this community has been fantastic.

It should be noted that not all device's are eligible for swaps--"child devices" are not. These could be devices listed under a "parent" device in the Devices list, but they could also be devices that an app creates (which will not show up in this way). This is due to the fact that the parent app or device usually has very specifically expectations, so a swap here might risk breaking things (and I'm guessing it would also be more complicated on the database side, but I'm guessing that was at most a secondary consideration).

It sounds like some of your devices may be child devices, so just note: if you don't see them in the list of devices you can swap, this is why.

1 Like

Looks like things via an integration app aren't eligible either.. I was going to swap out some LIFx bulbs with Zigbee ones, but the LIFx bulbs via the Lifx integration appears to not be an option for the original device... #Sadface

Right, devices created by an app are child devices of that app, and child devices of any kind (whether the parent is an app or a device) are not eligible for the feature. This is a limitation noted in the docs.

EDIT - Fixed typo/sentence I meant to finish :smiley:

2 Likes

Had my first chance to use Swap Apps Device and I gotta say, It works perfectly. It even properly updated all my webCoRE apps. My thanks go out to the Hubitat Team!

1 Like

Doesn't always work for me. See https://community.hubitat.com/t/swap-apps-device-bug/103998/4?u=user2232

That post is over a year old, and the one you replied to even older. There were some fixes/changes to this feature recently. What specific platform version are you running when you experienced the problem, and can you reproduce it on the latest?

1 Like