Sunset and “Left Open” Automation?

Somewhat off topic but need to appeal to the brain trust.

I have two MyQ garage doors with Ecolink tilt sensors.

I’m not trying to automate them, only get notifications. The specific one I need is to be notified if either door is open for more than 10 minutes at night.

I have the below routine but it failed me because a door was opened before sunset and left open all night.

I would suggest 2 Routines so you would know which door was open or SharpTools if you wanted to use a variable that would notify you of the specific door that is open using one Rule. that would require the paid version.

So the problem is the automation does not start tracking the time because when it opened the precondition was not met. I guess that’s a bug in the automation engine, isn’t it?

Personally, I would describe it as a design choice rather than a bug. It’s how all the preconditions work. They aren’t triggers, they are filters on the action which are only evaluated when one of the other trigger conditions is met.

If the device is already open, then there won’t be a trigger condition during the time period to kick off the rule.

If they didn’t design it that way, every rule would have to be continuously reevaluated 24 hours a day, which is one way to design monitoring, but it’s not the subscription model that the SmartThings rules engine uses. :man_shrugging:t2:

It would be clearer if it was described as “when the sensor opens and remains open for 10 minutes“, which has been an issue all along, for example with the old presence sensors which were really arrival sensors.

You can edit the precondition a bit then it should work

I got misled by the title then, the problem is not “crossing sunset” but that the door was already opened for more than 10 minutes before sunset?

So, yeah, another routine would be needed that checks at sunset if it’s been opened for more than 10 minutes. But since there’s no precondition for that, will have to use a virtual switch that turns on only when the door has been opened for more than 10 minutes.

1 Like

As I understand it, the problem is that the door is opened before sunset but only for a couple minutes, but it then stays open past the 10 minute mark.

So the 10 minute period crossed the sunset mark.

No notification was received, because the rule didn’t get triggered since the opening event was before sunset.

@HalD If you use the virtual calendar by Mariano you can add after sunset to the IF condition. You’ll need a routine for each garage door.

1 Like

Then we understood the same initially, but in that case it should work. The event of door being opened for 10 minutes happens meeting the precondition. In that case it should notify.

1 Like

I may have misunderstood it then. I’ve modified the title for now until the OP can give us some more details. :thinking:

1 Like

In my experience the open for X minutes timer only runs 1 time after the door is opened. If the door opened at 6pm but sunset was at 7pm the 10 minute timer has already expired so the routine isn’t triggered. You could replace then open for X min with open but would get notified everytime the garage opened between sunset and sunrise.

2 Likes

Exactly, it runs when it’s been 10 minutes, that’s the event.

The problem here is that the event happened before sunset. I would use a virtual switch that is on when the door is opened for 10 minutes and off when it closes.

And then two routines:

  • If at sunset, precondition the switch being on, notify
  • If between sunset and sunrise the switch turns on, notify

Or just a routine at sunset if the door is opened, no matter the time it’s been opened.

2 Likes

Thanks, everyone.

I understand why the routine failed me.

In this particular instance the door was opened roughly 2 hours before sunset and was forgotten. My habit is to open the connecting door to the garage to look while checking doors at bedtime. I failed to look, locked the connecting door and went on from there.

I’ll do some tinkering with the approach using virtual switches.

Thanks all!

3 Likes

Change condition from All to Any

Another alternative would be to use a virtual counter rather than the sensor “has been open” time. For example:

If Left Door Opens
Then
  Turn on Left Door Counter
If Right Door Opens
Then
  Turn on Right Door Counter
If Sunset-Sunrise (precondition)
  Left Door Counter > 10 min
  or
  Right Door Counter > 10 min
Then
  Send Notification that a Garage Door has been open for 10 min
If Left Door closes
Then
  Turn off Left Door counter
  Reset Left Door counter
If Right Door closes
Then
  Turn off Right Door counter
  Reset Left Door counter

You could probably do this with a single counter as well. Or if you want more specific notifications, you could use separate Routines to send a unique message for each door.

I use a variation of this method for sending notifications every 15 min that a gate or a door is still open.

I suggest the Edge Counter Utility for the counter.

2 Likes

This is exactly what I’m doing, except for the “wait 10 minutes” part. My scheme is to have Alexa say, “Alert! One of the garage doors is open!” if any one of three doors (two garage doors, one service door) are open after the hub switches to evening mode–which is sunset minus a few minutes. The announcement repeats every 20 minutes until I go close the door(s).

First part, which aggregates door state(s) is done with 2 routines:

IF any condition is met:
  Garage Door #1 is OPEN
  Garage Door #2 is OPEN
  Garage Service Door is OPEN
THEN
  vGarageDoorOpen is turned ON

Then, conversely…

IF all conditions are met:
  Garage Door #1 is CLOSED
  Garage Door #2 is CLOSED
  Garage Service Door is CLOSED
THEN
  vGarageDoorOpen is turned OFF
  vAlertGarageOpen, see below, is turned OFF 10 seconds later

Second part, which does the announcement:

IF all conditions are met:
  vAlertGarageOpen is OFF
  vGarageDoorOpen is ON
  vEveningMode is ON
THEN
  vAlertGarageOpen turned ON (and turned OFF after 20 minutes)
  vAlert-GD turned ON (which is used by Alexa to trigger announcement)

In this case, vAlert-GD is a virtual button (self resetting) which Alexa sees and uses to trigger announcement. The other virtual devices are all switches. I use “vWhatever” as a naming convention for virtual devices.

YMMV. And there are many, many ways to accomplish tasks such as this. I’m tempted to rewrite using one of the virtual timers drivers previously mentioned–but this works and I may never get around to it. :joy:

4 Likes

After working for a bit on something involving virtual switches the light came on for me (pun intended).

  1. I don’t have any concerns about garage doors open during the day. We often go out and work on the property for hours.

  2. I don’t really have any concerns about the doors opening in the middle of the night. If we come home late we’ve never left a door open.

  3. What I really need is a backup method to tell me one or more garage doors are open when I head for bed. This is in case I forget to check by looking in the garage.

Given all that, I figured out that there are is a specific set of outdoor lights that I always turn off at bedtime because they shine in the bedroom French doors.

So I created routines that checks each garage door when those lights go out. Problem solved… I think.

Postscript: I don’t have any perimeter sensors other than the garage doors and one sensor on the garage side door and I don’t use the security monitor feature. I do have Nest Outdoor cams at all doors but their interface to SmartThings is basically non-existent.

4 Likes

Just think how much simpler this would be with an ELSE statement! Just one Routine, instead of two–like a “real” programming language… :roll_eyes: :yum: :smile:

1 Like