Is there a way to post an operable Rule Machine rule rather than a screen shot?
No.
The closest you can get is an export, but that's not nearly as easily shareable. And in any case, you'll run into differences with devices one hub might hae compared to another, so if you mean "operable" as in something you can just copy directly to another hub and have work with no modifications needed at all, there are challenges there no matter how you do it.
Thanks for the quick reply!
I was hoping that there was some way to post a rule and then use something like the "clone" feature in RM to import it and change device names. Maybe in version 17...
That's what an export and import would do, if that's helpful.
But the trick is sharing the export. Most of the time that seems like more of a hassle than it's worth compared to the work of just creating the rule yourself from a screenshot or description. (Or at least I assume that's why it's never caught on here as a way of sharing anything...)
Thanks for the input!
Is it permissible to post a link on this forum to an exported JSON file stored in a public folder of a cloud account, in case someone wanted to import a rule?
I guess you could?
But rules seem sort of personal. In other words, your rule is written for a certain situation and certain conditions present in your home. It also would be written in the format you choose, with timing and delays and other things that meet the needs of your home.
What would someone else do with this? They would have to change nearly everything in the rule to personalize it.
I don't see why that wouldn't work, at least on a technical level. The above challenges still apply, and I suspect that's another part of the reason this hasn't really caught on as "the way."
Do note that, regardless of extension, the file is not necessarily JSON (so not intended for parsing, linting, human editing, etc.).
Also exports the full list of rules on the hub
Here's a way to export a list of all Rules to a spreadsheet and maintain hot links to the actual rules (note: this is for Hubitat ver. 2.4.0.134, might need tweaking for earlier versions):
- Collapse all Apps.
- Expand the Rule Machine app to show all rules.
- LeftClick on the app row (but not the app name) just above the Rule Machine app (for me, that's Room Lighting).
- Scroll down to the last RM rule and ShiftLeftClick on the last rule row (but not the rule name).
- Hit Ctrl-C to copy the selected rules.
- Paste (Ctrl-V) in cell A1 of a blank Google Sheets spreadsheet. This removes the "Disabled" control objects (pasting directly into an Excel spreadsheet does not remove those objects).
If you stay in Google Sheets, you can format to your heart's content to remove extra rows and extraneous columns. The rule links are hot, but require 2 steps to activate: click on a rule name, then click on the local HTTP address that pops up to link to the actual rule.
I generally work in Excel. To do that, immediately after pasting into the Google Sheets spreadsheet, hit Ctrl-C to copy that version and paste into a blank Excel spreadsheet. Again, format as desired. Excel has the advantage of only requiring one click on a rule name to link to the actual rule.
BTW, with slight adjustment, this process generalizes to generating a hot-linked list of ALL apps: fully expand the Apps listings (the Button Controllers app requires manual expansion of all child rules if you want them included), LeftClick somewhere on the page (other than a hot link), hit Ctrl-C and proceed with pasting into a blank Google spreadsheet.
I see the value of being able to share rules. It would allow you to create more complex automations by building off what others share. For those that use or have used WebCore, they know the ability to share your Pistons is a valuable feature.
Yeah, thinking about this further...(and this may be introducing more complexity than it is worth)...but what if you could build rules WITHOUT personalization.
That is, to create a rule as a non-live template within which everything you would wish to personalize is a variable or even simpler "a place holder" in the rule which you'd have to replace with a real device later.
OR
I manually "port" exactly the same rule between hubs, what if I could just export/import and replace the devices. When you clone a rule you are given a similar replacement opportunity.
Think of the "here, take the export of my rule, it does what you want" opportunities. Then on import you are presented with a device selection menu.
Isnāt that pretty much what already happens now when importing a rule?
Yeah I think it does do that already. The ability to export and share rules has existed for a long time, just no one does it.
I'm trying to remember my experiments in this awhile back.
I think I might have been left wishing to have a file I could edit outside of HE. But yeah, you're right some semblance of this has been there.
I've done it reasonably often, usually to use the same rule across different hubs. Hub variables are replaceable at import time, just like devices. Combined with judicious use of local variables, rules are pretty easy to recycle/reuse... Little known fact, you can interpolate variables in the rule name to customize it.
I didnāt understand this statement, could you please explain further? Possibly post an example?
I haven't had my second cup of coffee yet... so the permutations of this are coming slow.
Would this mean the Rule name could actually change every time the rule ran if you are changing those within the rule, or even better....be changing AS the rule is running/waiting/delaying etc.
So like this could be a quick way to know a rule is running, or hung, where it's at (cycles, repeats etc.), and basically present a "checkpoint" status if you so desired.
But you'd have to refresh the Rule list to see right?
Moderator: This thread might be best moved to the RM Category ?
Interesting⦠Didnāt know that. I can already see value in this. Thank you for highlighting this!