Minutes and Minutes Rule

Hello all!

Trying to learn the Hubitat environment; purchased a unit and moved over a couple dozen switches; I am moving from Webcore / Smartthings as I am absolutely frustrated with Smartthings dropping support for Echo Speak and have now disabled the ability for me to create new Webcore scripts.

In Webcore I have scripts that have logic like:
If a motion sensor has been inactive for 30 minutes AND a garage door has been open for 60 minutes THEN close garage doors.

Is this possible in Hubitat? I saw the cancel actions but didn't make sense how you would do two actions like this. I'm a little confused.

Thanks for the help!

Someone is going to tell you that you can use webCoRE on Hubitat, and that is true. So, if you're comfortable running custom code, that is certainly an option. But since Rule Machine is a supported part of the platform, I'd encourage you to try that first, so I'm not going to be that person (plus it's what you're really asking about). :slight_smile:

What you want is indeed tricky if you try to scope it all to one rule. But there's no reason you need to do that, and I think it's much simpler to break this apart. (While it's not as true as it used to be, sometimes you'll need to create multiple rules that work together to achieve the same automation goal.) Something like this uses a few simple pieces put together to do what you want:

Prerequisites

  • Create global Boolean variables, one to track the sensor and one to track the garage door. Say, garageMotionStayedInactive and garageDoorStayedOpen. This is done in the Rule Machine "parent" app.

Rule 1

Trigger: Garage motion changes

Actions:

IF (Garage motion active) THEN
  Delay 0:30:00 (cancelable)
  Set garageMotionStayedInactive to True
ELSE
  Cancel Delayed Actions
  Set garageMotionStayedInactive to False
END-IF

Rule 2

Trigger: Garage doorchanges

Actions:

IF (Garage door open) THEN
  Delay 1:00:00 (cancelable)
  Set garageDoorStayedOpen to True
ELSE
  Cancel Delayed Actions
  Set garageDoorStayedOpen to False
END-IF

Rule 3

Trigger: garageDoorStayedOpen becomes True OR garageMotionStayedInactive becomes True

Actions:

IF (gagarageDoorStayedOpen is True AND garageMotionStayedInactive is True) THEN
  Close: Garage Door
END-IF
1 Like