Write code directly?

Is there a way to write the code for these rules in a text editor and then import them? Or is using the web UI the only way to create them? The UI is pretty terrible and it just seems like it would be easier to write them in a text editor.

If not than can I make a suggestion.... have you ever used Workflow/Apple Shortcuts? That's the kind of UI this should have. If you used a modern JS framework like Angular or React you could create something similar that ran in a browser pretty easily.

I really like the power of this device, but the UI leaves a lot to be desired.

2 Likes

No, unfortunately that is not possible with Rule Machine.

If you're a programmer, you could actually write your own Apps in groovy for the hub. Then you can use whatever text editor you'd like, and then copy and past the code into the Apps Code or Drivers Code sections of the hub.

3 Likes

No.

However, there are methods not supported by Hubitat staff that permit the creation of automations using a GUI.

One such example is Node-RED.

Here's an example of a simple automation in Node-RED that uses the status of a contact sensor on the attic door to control the attic light switch.

Untitled

4 Likes

That is a funny example as that is actually one of the automations I use. Exactly.

1 Like

While definitely not as pretty as Node Red... Here is the same Automation using Hubitat's built-in "Simple Automations" App. No need to use Rule Machine except for truly complex logic.

3 Likes

Ok now I feel like an idiot. I thought RuleMachine was the only way to do automation. I didn’t even realize there was another way. I'll have to give this a try. I have two simple ones like this where a door switch turns on/off a light.

2 Likes

No need to feel that way. There's plenty of simple, very efficient, built-in apps. Simple Automation and Motion Lighting are two that are particularly useful.

4 Likes

No worries. You should definitely try the following apps before using RM...

  • Simple Automations
  • Motion Lighting
  • Notifications
  • Button Controllers
  • Mode Manager
  • Hubitat Dashboard
  • Groups and Scenes
  • Hubitat Safety Monitor

That should cover hopefully 80%+ of your needs! :wink:

4 Likes

Look around the owners are aware and want to make good change.

I, like you, dont really want to write my own apps. I'd rather be able to look at the Rule Manager code after it's done and make tweaks. (But I can see how that would cause a support nightmare for Hubitat)

you can do this in webCoRE - ie write code, edit it.

It is not a text file per se, but a web page that can write code, move code around, etc.

4 Likes

I will say this:

It's good that you were introduced to the simpler built-in apps. Hopefully that does take a lot of complexity out of the things you want to do. --And there's a lot of power in those, too, as it pertains to being mode-aware and such.

Regarding the "pretty terrible" UI of Rule Machine:
I will agree that it was ANYTHING but intuitive when I started. --Especially with the specific quirks in HE about clicking out of a box after you make a selection, which locks that selection in and opens up the next step, etc. I had no clue what I was doing with the UI. No clue. "Insert before" and stuff...it took a while. And there's an argument to be made that intuitive is objectively good.

HOWEVER: I just want to say that, with time, and with more use--not even study and practice, but just normal use--the interface becomes very second nature, and it doesn't even seem weird anymore. I had some experience with WebCORE before coming to HE, and while I'll admit it was a little more intuitive for a beginner, and seemed more powerful (because you could see everything at your fingertips, instead of features becoming available based on context and where you were in the process), it no longer feels superior in any way. I think about automations in "Rule Machine" ways, and it's very easy to deal with now.

Good luck! --And if they want to come up with an easier-to-learn flow, I'll be happy to see it as a refinement of this platform. Win-win

3 Likes

I agree, after using the UI for just a few hours...it is not as bad as I thought the first time I looked at it.

It's a difficult thing to make a UI that exposes a lot of power/capability. I think honestly the only things lacking are some layout/coloring to make it easier to "see context". I've seen some threads that the developers are exploring way to do that kind of thing.

1 Like

So many times I would have loved a direct text editor for RM. Usually it was from finding out a way to get something to work in these forums, and wishing I could paste and hack. That's how I do all my "coding" on the Hubitat, and most of my "coding" elsewhere!

2 Likes

I would settle for a way to move RM rules from one hub to another. It's good to have a development hub to try out new things, but it's a colossal pain to have to re-do them click by click to move them into production.

2 Likes