Cancel delayed action based on Change in Rule Truth

I need some help, making a rule, it seems simple enough but I can't figure it out. I have Blue Iris cameras and they send local end point triggers to hubitat very reliably. I have used these camera triggers to run many rules, love it!!! I also define presence by wi-fi phone presence sensors, it works 100% all the time and I am not interested in the available geofence options. When either my phone or my wife's phone are near the doors or inside the house, hubitat reports present, otherwise hubitat reports not present. It is important to note that my presence changing to present will disarm "Armed Away" in HSM

The rule I CAN build is as follows (I can build it in Rule3.0 or Rule4.0)
Trigger: Camera senses motion (local end-point trigger)
Conditions Required: HSM is Set to "Armed Away" OR Presence is "Nobody Home"
Actions: Refresh Wi-Fi Presence Sensors and Send Message to Phones: "Camera Senses Motion"

The problem with this rule is simple, when I arrive home (my wife is still at work), the camera senses my motion and Refreshes my Wi-Fi Presence, which causes hubitat to change my presence to "Present" which then unlocks my door and disarms the alarm (GREAT!!!), but it also sends a message to my phone and my wife's phone: "Camera Senses Motion" (Not Great). The solution to this problem seems to be to delay the message by 10 seconds and cancel on truth change. I don't know how to do this. In Rule3.0 this is a triggered rule and therefore there is no option to cancel on truth change (too bad cause it would have been an easy solution for the above scenario) and in Rule4.0 I can't figure out how to do it. Thanks for any help.

There's no cancel on truth change on triggered rules, including RM4, because there's no "truth." The rules are triggered by an event.

You need conditions within the rule that will determine what the "truth" is. Something like:

Triggers:
    motion detected

Actions:
    IF HSM is Armed Away OR
    presence is Nobody Home THEN
        Refresh wifi presence sensors
        Delay 0:00:10 
        IF Presence is Nobody Home THEN
            send messages
        END-IF
    END-IF

Thank-you. I think I am just having a hard time wrapping my head around Rule4.0, I made this:

. As opposed to nesting the If-then-EndIF. I just made two If-Then-End-IF with a 5 second delay between them. Hope it works.
Thanks

That will work. There are a number of ways most rules can be put together. This would work, too:

Trigger Events:
    Motion

Actions:
    IF HSM status Armed Away THEN
        Refresh presence sensors
        Delay 0:00:10
        IF nobody is home THEN
            send messages
        END-IF
    END-IF

Or this:

Trigger Events:
    Motion

Actions:
    IF HSM status Armed Away THEN
        Refresh presence sensors
    END-IF
    Delay 0:00:10
    IF nobody is home THEN
        send messages
    END-IF
1 Like

Thanks for your help. It is appreciated. I think I am going to like Rule4.0 I just tried putting all my front camera rules into one rule and it seems to be working. It's nice to have everything under one rule based on one trigger.

I wonder if this is the best way (processed fastest by hubitat) to write the rule or it doesn't really matter which way you write rules as long as they work.

I think your rule looks great.

I'm not an expert here. But personally I think a lot of it is just style. Some people like to do something one way, and some people like to do it another way, and some will defend their choice to the death. I like to go with making it work first, and then later looking if I can make it more elegant or more efficient. But always "works" is better than "looks good." There are discussions you can probably find if you search for them regarding how many milliseconds one approach saves vs another, but I don't recall any discussions that concluded that in most cases it really mattered,

When RM4 first came out, I went crazy and put everything that happens every time mode changes into one humongous rule. It work, more or less. But the UI struggled to open it if I wanted to edit something. And sometimes it really did bog down. In the end I split it up into one rule for each mode, and everything has been happier.

I think it's @bravenel who says rules are free and KISS is better, and I must say there's something to be said for that approach.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.