Comments in RM

Hi all,
Is there a way to add comments into RM? I like to comment my code so in a few months (after killing off a few brain cells :grinning:) I know why I did something.

There is a "Notes" section at the bottom of the rule intended for more or less this purpose. There is no per-line or block comment functionality.

Ok, thanks.
@bravenel, can I humbly submit this is a future feature request? RM is so powerful that being able to add comments inline would be helpful especially as the rules get more complex. Thanks

While I like the idea, it’s been asked for before. Bruce has said no previously.

1 Like

you could make a local string variable and save the comments to it for each needed line.. I'm not sure what the text limit is for the string variable.

I am not sure this is what you want, but probably the closest thing other than the notes section.

I'll give that a try, thanks for the feedback!

You could also use a log command. Not perfect but good enough although of course it will clutter your log stream.

Yep, look up two posts. :grin:

Oh yeah, woops :grin:

1 Like

I know this thread is 8 month old, but I believe that commenting is needed. I don't agree with the arguments that RM is not programming but rules or actions or what else. These are just terms because programming is also just a sequence of commands or actions or however you want to call it.

Hubitat rules can be so complex and confusing that commenting would be a great feature regardless of what RM is. Commenting does not just exist in programming languages and other hubs have it also.

Hubitat should hear on users for requests. A log message is not a good solution for me as my logs are already overflooded with information. So I want to bring this up again.

You don't need to log; as suggested in the other thread, you could use a virtual device, like one that accepts commands for notifications but doesn't actually do anything with them. While it can't hurt to resurrect this feature request, since it's been asked a few times and the response has always been "no," I'd use a workaround (already possible today) instead of holding my breath.

That being said, it seems you are not a stranger to programming. Perhaps you would rather write your own custom Groovy "apps" for the hub. You can use standard Java/Groovy comments there as much as you want. :slight_smile: It can be a bit difficult to get started, but there are lots of existing community apps you can look at to get started (and the SmartThings "classic" SmartApps docs aren't that different), and lots of people here who would be willing to help you, too.


There’s a notes section for every rule. Perhaps you could use that? Many others do.

Yes, that's a work around, but not a good one as it uses processing time and comments are simply ignored by the kernel.

I tried this, but that also isn't a good solution. You don't see the code in colour and no indents are used. The major downside is that you need to update the info every time you do changes. We need inline comments.

Well, RM is not a programming language. Perhaps, @bertabcd1234’s suggestion is more in line with your needs.

Being forced to use a workaround for a feature request that is clearly valuable and asked by many users is just a showcase of a company not hearing on users. I can understand arguments like we work actually on more urgent features and fixes and we have set comments to a later integration in our roadmap, but a "no" is hard to understand.

Well, do you want Hubitat to add something artificial to an app that could hinder its operation?

If RM were a programming language, adding commenting would be simple (and have no computational cost). But, it isn’t. It’s a complicated Groovy app with several thousand lines of code. At one point I heard around 7000.

Why is everyone insisting on "programming language". I see the ability to comment as well in scripting languages and in rule engines called flows and even in process instructions for CNC engines, and so on.
Documenting is important in every flow, be it programming, scripting, rules or anything else.

That option is already available.

1 Like