How to make a set of actions reusable?

Hi guys

Say I have the following set of actions

Turn on LIGHT 1
delay 3 seconds
Turn on Siren
delay 3 seconds
Turn off Siren
delay 5 seconds
Turn Off LIGHT 1

I want to make it so that this set of actions are reusable for any trigger such as:
When movement is detected
When Button is pressed
At every 12nn
...and other triggers and conditions..

I've figured out how to set these actions on each trigger but it's getting tedious to have to program all these actions for every trigger... and updating this set is even worst if i have to go into each trigger and update the actions accordingly.

What's the best way to go about this?

I don't use Rule Machine anymore but I believe you can create Rule A that does those 4 Actions without a trigger.

Then create as many other rules as you want with any trigger and the action for those other rules is to run Rule A. Someone else, please correct me if I am wrong.

4 Likes

This is exactly what I do. I have rules without triggers to turn on most of my light groups and scenes. This way I (or you) can call that list of actions from a button press, a dashboard, motion, timer, mode or whatever. I use light groups and scenes almost everywhere too. This way bulbs can be moved in and out, on or off the hub without breaking or editing any rules. Only update the effected group or scene. Rules are free and the simpler the faster.

RM, I believe was meant to be used like Legos™; each rule is a piece of a full automation. Back when I used webcore on that otherHub I would build rules with 20+ lines. Now I have maybe 3-5 short rules and scenes to do the same thing, but they're fast, reliable, and simple to upkeep.

1 Like

I see. I'll give that a shot when i get back home. Thank you!
And great idea on the groups and scenes to keep things "modular".. will definitely give that a shot!

tnx, but if i may ask, why dont u use Rule Machine anymore?

I started using it because its visual and makes more sense to me. I have kept using it for multiple reasons:

  • I have multiple hubs with Zigbee devices on one, Zwave devices on another, and all Wifi/community integrations on a third. Node Red allows me to use devices in automations from all without relying on HubConnect or the new Hub Mesh.
  • There are ways to control devices not natively supported on HE
  • Easy to duplicate or share rules. This was especially helpful when creating flows for my Pico remotes. After making the 1st, it was easy to copy and tweak for the rest of my Picos.
  • Not reliant on any one system or hub if I decide to move to another in the future.
  • Removes some load from hubs

There is a great thread going but it is over 4k posts and is a lot of information to take in:

1 Like

I would add..

So i created Rule in RM w/o trigger .. but now on my button how can i trigger this Rule? I dont see an option for it in the Button Actions....

@tj1 To tie Node Red into what you are doing, you could create a sub flow with those 4 actions. Then create other trigger flows and that sub-flow is a single node and can be used all over. When your make change to sub-flow, it applies to all cases throughout Node Red.

tnx for introducing me to node red. I will definitely try this for my home build.

But for professional deployments such as this one (i install Smart Home stuffs for customers) i cannot use node red as it complicates things further. More moving parts = more things that could break or need maintenance and support (in a production environment) so i'm always looking for the simplest route more stable and less experimental route ... I dont mind spending hours tinkering and troubleshooting on my automation at home but i'd hate to have to do that to over 30 clients lol

So for this one, I wanna execute most my client's need with just Hubitat + 99% z-wave devices ...just to share. (unless i got Node Red wrong and it's being used in production/mission critical environments already.

1 Like

Is your hub running the most recent version of the hub firmware?

The options you have in that screenshot don’t quite match up with what I see when I open rule machine. The rule machine UI gets tweaked periodically as new versions of the platform are released.

However, “run rule actions” isn’t new, and so I think it should be in there somewhere. Can you check if it’s hiding in the “run custom actions, polling” sub-menu?

I agree; I definitely wouldn't use Node Red if I was installing professionally for clients.

Here is one more thread to help you get started for your home experimentation:

I have to respectfully disagree @tj1 and @stephen_nutt! :smiley:

I am installing HE, Node-RED (and Homebridge) for my residential clients and it has been a fantastic experience. My oldest install is almost a year old. I have 3 in the wild currently and a 4th due to go online sometime soon. I also "sell" support services - remote maintenance is very easy. I cannot recommend it enough if doing residential home automation installation/consulting.

The trick is to have a robust baseline installation - proper equipment selection (server, power backup, switch, standard set of smart device choices etc), installation plan, software selection, standard set of nodes/custom subflows/sequences etc.

Now Home Assistant on the other hand - wouldn't let that near a client if I could help it. Still too complex for my tastes - although I guess I could see how someone could do it with a very locked down minimal configuration. I just don't have that kind of time. It is fun to tinker with though so maybe some future iteration will revisit.

3 Likes

hi mark
i've actually just updated earlier today. i've got this, the latest i believe
image

and about my earlier screenshot that's actually from other actions menu
Apps -> Button Controllers
Apps -> Basic Rules

I'm trying to link button action to trigger/run my Rule Machine profile.

Ah, that’s probably it.

Rule machine has a button device trigger, much like the separate button controller and basic rule apps.

It has more options for actions though, basically everything that’s otherwise available in rule machine.

But I think you’d need to use a rule to call other rule actions.

Button controller and basic rules probably can’t.

oh bummer .. i wonder why a button trigger can't just trigger a rule to run, doesn't make sense not to have it in there.. perhaps the devs missed this and we'll get it in future updates.

For now, how do you propose I, ultimately, run my RM Rules from a button action? Global variable stuff?

You are looking in the action section - you will find the button controller as an option in the trigger section of the rule.

You can add multiple triggers to the same rule (Button press, motion, etc...)

1 Like

Ah yes, tnx but that's pretty much the standard way really.

Once again I'm trying to create a set of actions that can be triggered by buttons and different events (triggers external of the rule)

Thus I created an RM Rule (no triggers) that does the actions i need.
Now i just need to trigger / run it from buttons and whatever ......

Basically, I need to run the RM rule from the one or more of my buttons and other triggers that are not part of the RM rule's configurations.

....I looked inside Button Controllers and BASIC Rules section and they both don't seem to have any option to RUN an RM RULE

I simply want to RUN an RM RULE (my set of actions) from button actions without encoding that as a trigger inside the same RM RULE

The only way i seem to be able to do this is creating yet another RM RULE just for the button push, to run another RM RULE.. which feels weird.. but if that's how it should be then im cool with it
:smiley:

It is possible to setup a rule to trigger another one. Is this what you are looking to do?

That First rule (Test Rule 1 in the example above) can be triggered by whatever you want (button press, motion, etc.)

1 Like

Nope i pretty much got that already at first go. :slight_smile:

What lead me to this rabbit hole is I was setting up my Buttons via the
App-> Button Controller

and in there the actions did not have options to trigger/run a RM Rule

I think that HUBITAT devs forgot this option in the button controller configuration :stuck_out_tongue: