Changes To Rules Engine Super Simple to Medium

So Rules engine has a lot of promise but its also very frustrating to use sometime.
Here are 4 changes that I think would be a God sent:

  1. Save As
    Save a Copy of the Current Rule with a different name. This would be Seriously helpful especially when a rule that needs to be applied to multiple controls but they don't share the same outcome. IE the Virtual to Real Fan Rule. I don't know how you implemented your system but on nearly every system I have worked on adding a save as only involved passing in a different Id to the Database with the Upsert.

  2. Device Base Context Filtering
    Start the Rule with List of controls it has access too. Take the Same list that is in the "Amazon Echo Skill" and tack in on the top. It would default to all devices for backwards compatibility. This list is then used to filter all list presented to the user to see of the item in the list applies to the current devices. So in this example below I have added only a Dimmer and a Fan Control.


    Note: I'm using this as a basis for the rest of the examples
    So in the List for conditions That has for every possible action even for devices I don't have on the system now becomes a list that is much more manageable.
    So from this:

    to this:

    A Contact Condition does not make sense for a fan or dimmer so it does not show up.
    And that Action List would go from this:

    to this:

    The effect for this list would be more dramatic if the Action Type was more split up.
    And this list

    To this:

    I would also recommend checkboxes to filter out Time, Date, Custom Actions, scenes, ect and have an even greater effect of reducing the length of those lists. (I thought of this after making those examples)
    The reason for this should be self apparent. When working on a rule this will drastically reduce the time it takes to create rules as the only options in the dialogs are ones that make sense.
    The system already limits a list of devices based on the context IE for when a condition for Contact Condition You only show contact sensor a switch would make no sense there. So There is already code that makes that association this would use the same one and just flip it. Again I don't know how your system is implemented but I can't imagine this being difficult. It is just filtering what is being pushed down to the select and eliminating the list items on the render.

  3. Text Base Import Export.
    Everyone likes cool UIs to set things up but when writing code they just get in the way. even with Webcore which is one of the better implementations I've seen, it took a while with hunt a peck searching.
    So it would be great if the Rules Machine allowed exporting of the current rule to some format even a confusing Json forma tand with a warning saying this is subject to drastic changes would be greatly valuable. This would even take care of number 1 in this list.
    If you have some form of serialization for the rules this should be super easy.

  4. Templates
    So a way to generate a rule from a template would be super useful. This would be another button in the "Create New Rule" page called "Create From Template". When clicked it would bring up a dialog. This dialog that would consist of a list of templates and parameters. The Templates would be a list of predefined rules Have a list of predefined rules like "Turn on/off when closed", "in the morning turn on", "When I leave Turn off" and so on. The parameters would be Devices. So the Turn off when closed they would have one parameter for Whats closing and one parameter for Whats being turned off. This would be great to generate a simple rule quickly. It would also make it easier for the uninitiated to learn your rules engine.
    I'll admit the Difficulty on this one is must higher then the rest you now need to store a list of templates and maintain it and a new dialog but it still should not be that difficult. And the parameters would have to be filtered to make sense in that location. To added even more complexity and much for functionality it would be great if this template list was editable by the end user.

I would love to see any and all of these ideas implemented. I truly believe they will increase the value of your product dramatically. The more flexible it is the greater the power users will sing your praises and the more usable it is the more likely you will have the less tech enlightened to buy this.

The last one is basically the point of apps. There is a whole stack of these availble already to accommodate a huge range of common use cases. In my opinion RM is simple enough for most other things without adding another complicated templating approach which again will never do exactly what I want anyway.

Cloning of an existing rule is coming. But we can't talk about it yet :smile:

Regarding UI for flows and reducing list complexity, agree this is needed. The UI is very klunky in my opinion. But really it needs more - a seasoned UI expert adept at all the latest front-end wizardry to grab it by the horns and drive some more fundamental improvements in my opinion. But it seems to me that right now the focus is clearly (and maybe correctly) on functionality first.

As stated above, staff have mentioned that rule cloning is coming. Hopefully you'll find that helpful! (That being said, it might not save a bunch of time since you still have to swap out the devices, so for things you do all the time, I second the recommendation to consider using or writing an app that would accomplish the same thing. I also find apps easier if the devices change--it makes the rule hard to read if a used device is removed, but it is easy to just go and swap out in a regular app.)

I agree that the UI for RM could be better, but they are working with constraints imposed by a system they did not develop (the framework is the same as SmartThings, and a lot of app code is shareable nearly verbatim between the two, perhaps for ease or porting or perhaps because they aspire to be bought out by Samsung one day--anyone's guess :slight_smile: ). It's getting better with each version, but I suspect they'll reach a point at which the existing constraints limit further improvements. Your suggestion is certainly one that looks like it would fits within this system and could be used to filter the lists a bit, but it seems like it adds more clicks up front in order to just save a bit of scrolling later, so I could understand if they don't see the value in adding something like it. Once you use RM a lot, you get used to where things are in the lists, so if you're new to it, hopefully that will come soon enough!

What would really help, in my opinion, is a new app UI language/paradigm. The existing one is fine for most apps, but it shows its limits with the awkwardness of many things in RM, like building conditionals in actions (or even complex conditions...or trying to re-order actions...or lots of other things I'm probably de-sensitized to by now). I suspect this is why CoRE on ST moved in the direction of webCoRE. Perhaps we'll see a webRM some day with a locally-hosted, friendlier-for-script-writing UI (or even a new UI paradigm usable for RM but available to all apps), but that's just a dream of mine at the moment. :slight_smile:

This is coming in Release 2.1.2.

This was actually a feature of the prior release of Rule 2.5. It could be brought back -- I will look into doing so. Rule 3.0 is fairly new, and it didn't fall into place to do this the way it had been done before. Doing so was put on a back burner.

This is not likely to happen for a number of reasons, not the least of which is the complexity involved of supporting the import of such a text file. For now, the platform does not support this. However, the fix for point number 1 will help.

Have you looked at Simple Lighting? I'd be curious if it comes closer to meeting this need.

Having said all of this, a new version of Rule Machine is coming that changes the UI to a simpler form than it is in 3.0. Perhaps this discussion could continue after you see what that has to offer.

8 Likes

Have you looked at Simple Lighting? I'd be curious if it comes closer to meeting this need.

I have and its great for a few things but very limited as its basically only one template.

Having said all of this, a new version of Rule Machine is coming that changes the UI to a simpler form than it is in 3.0. Perhaps this discussion could continue after you see what that has to offer.

I look forward to it!

That being said I have written a few lexical analyzers and rule systems in the past. I would love to have a crack at writing one for Hubitat. Though the more I start digging into Groovy and the API for Hubitat the more I realize that Groovy might be the best one for it. Could use a layer to simplify interfacing with all the possible devices though.