Safe To Rename Modes?

I found a thread about this a few years ago about this: Interesting.... don't rename Modes - :triangular_ruler: Rule Machine® / All things Rule Machine - Hubitat

but no definitive answer to the question, can I change the name of existing modes without breaking things?

The UI lets me do it so it ought to be safe, and anything that uses modes ought to use some internal immutable ID rather than the textual name, but how various things actually work may be a different matter. I only really care about RL and RM, I don't think I'm referring to modes anywhere else.

Before I end up breaking all sorts of things, can anyone say definitively whether it's safe to rename a mode? (I don't want to delete any, which of course could break things). Thx...

I can say I have recently changed mode names successfully. Of value is:
image

I used the 'find broken rules' and did discover one that was an older rule that got brought across a migration from a c5 - it had a human error typo discovered this way (in a string compare I had written)

Thanks. I have lots of stuff in RL though, and there's no "find broken rules" functionality there.

I suppose Bruce would have to say for sure on both apps, but a quick look at the internal data suggests that both use mode IDs in most places, so you should be good. But I do see RM using the mode name to create the subscription if you have a trigger for a particular mode change. The setting uses the ID, so you won't have to re-select, but you'll have to hit "Done" or "Update Rule" to get the right subscription set based on that.

There also could be other places where modes are referenced by name; I didn't check every possible use of them. I'd suggest taking a backup before making this (or any big) change, checking things afterwards, and knowing you have something you can restore to in case there's something you can't easily fix.

RL appears to use IDs, but again, there are many places you can select modes and I can't claim to have found them all...

Curious, how did you do that, or do you have some special access?

It just occurred to me that one of the drivers that I wrote will not handle mode renaming very well. Ugh...

Just a look at the App Status page (plus reasonable guesses as to what's what).

Drivers do not have access to location mode (I thought...apparently they mostly do?).

Never occurred to me to look there, thanks!

Sure do. location.getModes() returns list of modes, location.setMode() sets the mode by name. location.setModeId() doesn't appear to work.

1 Like

Interesting...I was not aware that worked. :slight_smile: (and not sure if it's supposed to, but that's another issue haha)

1 Like