RM 4.0 Rule Questions and Optimizations

IT WORKED!!!!! Man I owe you! Can't believe it was that simple. This is the first time using RM so I am still a NOOB on it. You saved my evening of trying to still figure this out and I really appreciate it!

No worries, glad I can help! Enjoy your night and HE.

Noob question here re: optimizing RM4.0 rules. Want to decrease CPU load but so far have not gone to offloading some load to RPi so want to optimize my use of native apps. So...

Was wondering, is it better to run several smaller rules or one larger rule in RM4.0. For example, I have various security warning announcements broadcast over outdoor perimeter speakers whenever certain motion sensors are triggered. These warnings vary depending upon 1) mode (day, evening, nights), 2) armed state of security system (away armed, stay armed, not armed).

Is there any difference in cpu load between:

  1. running three smaller rules one, for each mode as a condition paired with each armed state (but all with the same motion trigger), OR
  2. one larger rule with 9 permutations of the conditions in the IF portion of the rule,

Although in this example, the IF-THEN-ELSE is relatively small even in the single larger rule case, do more lengthy and complicated rules suffer from any potential execution lag time? In other words, does increasing the number of rules potentially slow HE down more than the length and complexity of the rule, or vice versa?

Sorry for the noob question but am just getting into HE. TIA for your insights.

The overall consensus is smaller simpler rules are the way to go.

You will find it will also increase your amount of reuse - ie one rule triggering or calling another.

For instance my bedtime routine calls my lock controller RM, welcome lights (outdoor) RM, my mode controller that triggers a bunch of individual mode controllers. I just make sure to sequence things. If you trigger too many other rules at the same time without any delays your zwave/zigbee can get really busy.

1 Like

Thanks @steve.maddigan! Unlike many here, I havenā€™t incorporated Zwave or Zigbee devices into my HE system. Local control is via Shelly local WiFi relay modules (very strong and reliable WiFi coms with MQTT and relatively cheap for those that like to tinker), Lutron Homebridge PRO, Envisalink and (unfortunately, for those liking the Cloud independent feature of HE) cloud based integration via Alexa for those switches and items I have that cannot communicate with HE directly (e.g. CbyGE in wall dimmers etc).

So far (am new to HE) Iā€™m guessing since CPU load is relatively light in my case (although Envisalink seems to maintain quite busy chatter over Telnet...I use all 64 zones in my home) I havenā€™t experienced (as of yet) the dreaded progressive sluggishness that many have reported other than the expected slight lag when the HE has to go through the Cloud via Alexa.

Out of curiousity, do you think that the slowdowns have been primarily due to Zwave and Zigbee related issues, or has the cpu been susceptible to overloading primarily due to scripting problems within the Apps (excessive polling, programming inefficiencies etc)? I have been trying to minimize my App usage and complexity for fear of encountering slowdowns (for example, since I use Alexa or a keypad to arm my security system, I donā€™t use HSM to cut down on at least one app (Iā€™m guessing HSM is a pretty substantial app). Instead, I just get the Armed Status of my panel into HE by a physical relay connected to a Zone that triggers a virtual contact (since Iā€™m using the Envisalink Integration App already anyway. So far everything has been solid and reliable with my HA but am concerned with reliability and lag when my system gets more ā€œheavyā€. I would like to avoid having to offload any heavy lifting to a RPi if possible. Perhaps running two HEā€™s?

Any thoughts on this, or am I just making things more complicated than they need be? Anyway, once again, thanks for your advice and expertise.

I could use some help here

We have 5 camera around the outside of our house, when each detects motion, it turns on a V-Switch via an Alexa Routine, thus triggering the rule below

I send my wife on a lap around the house to trigger each camera motion

Since it's daytime, we are currently in Home mode here, so the IF statement runs as expected.... Then 3-4 mins later, we get the same announcements as when she lapped the house the first time

Is it b/c the trigger is set to "changed" and when moving between each camera it keeps retriggering the Rule?

I guess one way to fix this is to create 5 individual rules however I would rather have just one

Thoughts?

Thanks, Rick

I canā€™t comment on the slowdowns. The staff has been incrementally chipping away at contributors.

Re: cpu power - they say itā€™s not an issue.

I have experienced minor slowdowns I the past and a manual reboot has cleaned things up but havenā€™t had any issues for a while. Two other instances I had included a bad zwave device and another time where I misconfigured an app and the update to a bunch of devices whatā€™s taking place way too often.

RM does give you the power to do it to yourself. For instance if multiple triggers launch many threads of the same RM, or multiple RMs all triggering from the same trigger. Mapping out your logic before implementing it is a big plus, especially if you are new to it.

Re: HSM I donā€™t know. I tried it once to monitor five leak sensors and i got it to alarm and I silenced it and it didnā€™t go off again when the second one triggered, so I abandoned it and wrote an RM to handle it.

Steve,
Thanks for your experience. Part of the reason for my question was my concern (as you mentioned) of using the same trigger (in my use scenario, the outside motion sensors) to initiate several smaller rules. To prevent any confusion on the part of HE, I wrote a larger rule with that one trigger, with the various possible outcomes (actions) determined by a pretty extensive chain of stacked conditional arguments (rather than several smaller, simpler rules triggered by the same trigger). Seems to be working well so far. Thanks again for your help, itā€™s much appreciated!

1 Like

Man, This is a big one. but I think It can be made a bit easier to work with.

Trigger:  Motion1, Motion2, Motion3, Motion4, Motion5 any turns on

Actions:
IF Mode is Home
    Speak "%device% was Detected"
ELSE-IF Mode is Evening
   On light1
   On Light2 Delay 2
   On Light3 Delay 3
   Speak "%device% detected Lights turned on"
   Wait for condition  Motion1, Motion2, Motion3, Motion4, Motion5 all off
   Off light1
   Off Light2 Delay 2
   Off Light3 Delay 3
END-IF

Then if you wanted to keep the announcements to only so many times per some period. you could use a Private Boolean to de-bounce the rule. If you search the community for de-bounce or debounce you should find lots of examples.

1 Like

Thanks for the suggestion, i'll gen it up and test it out

:slight_smile:

the is what i use
You can use this app to get all sensors together https://docs.hubitat.com/index.php?title=Zone_Motion_Controllers

For RM here is some example of what you can do with repeting loop util no movement or until the # of repetitions have being reched.
Select Trigger EventsGate, Doorbell/ Street Door, En trance Door any open
Select Actions to RunIF (Mode in 1Day, 2Evening, 3Dinner(T) [TRUE]) THEN
Wait for condition: Gate, Doorbell/ Street Door all no movente TRUE --> timeout: 0:15:00
Repeat 5 times every 0:10:00 (stopable)
IF (Gate, Doorbell/ Street Door any movement(F) [FALSE]) THEN
*****Speak this *********at this device
ELSE
Stop Repeating Actions
Exit Rule --> delayed: 0:00:01 (cancelable)
END-IF
END-REP
Wait for condition: Gate, Doorbell/ Street Door, En trance Door no movent TRUE --> timeout: 1:00:00
IF (Gate, Doorbell/ Street Door, En trance Door any movement(F) [FALSE]) THEN
*****Speak this *********at this device
END-IF
END-IF
IF (Mode in 6Night, 4Dinner talk, 5Home 11.59(F) [FALSE]) THEN
Wait for condition: Gate, Doorbell/ Street Door no movement TRUE --> timeout: 0:05:00
Repeat 5 times every 0:10:00 (stopable)
IF (Gate, Doorbell/ Street Door any movement(F) [FALSE]) THEN
*****Speak this *********at this device --> delayed: 0:00:05
ELSE
Stop Repeating Actions
Exit Rule --> delayed: 0:00:01 (cancelable)
END-IF
END-REP
Wait for condition: Gate, Doorbell/ Street Door, En trance Door no movement TRUE --> timeout: 0:30:00
IF (Gate, Doorbell/ Street Door, En trance Door any movement(F) [FALSE]) THEN
*****Speak this *********at this device
END-IF
END-IF