[SOLVED]: Buggy Vera Home state - Advice needed

I’ve moved a lot of my scenes away from the default Geofencing built into UI7, because frankly, it sucks. I’ve had so many support tickets open with Vera regarding their Geofencing, that I’m just not going to deal with it anymore. I set up new scenes using the iPhonelocator app, and it’s working much better for the most part. That being said, I need some assistance with the logic to replace actions in the Home Modes. Right now, if the Home Mode is set to Away, the Garage Door is supposed to be closed. Because of the polling on the iPhone locator, and the Google API not being free for it anymore, I have it set for several minutes, so I when I arrive home, it may or not register as Home for a couple of minutes. The problem come when I get home, but the Home Mode is still set at Away, it will try and close the garage door on me very shortly after I open it.

So, what I need to do is set a PLEG program to close the door if both my and my wife’s iPhones are away, but not if the garage door was opened in 5 or 10 minutes, whatever I decide. I also have a door sensor on the door to my mudroom that can/should be used as a trigger. I also want it to close the garage if I’m home, and have left it open for a specified time. I may also need to make a virtual switch to disable closing it when I’m home, if I’m working in the yard and want it to stay open.

Anybody do anything similar? Advice? Things you may have run into?

I do not like the idea of my overhead door closing without a human being involved. We have a camera in the garage to monitor what is happening but it is always a person closing it.

We have iPhone locator set up via PLEG to change to Home if we are both home, Away if both gone, and Vacation when both phones are more than 100 miles away.

Lastly, when the overhead door is opened, it starts a 10 minute timer. If left open, I get a notification every 10 minutes the door is still open. (Similarly, we get a notification the front door is left open every minute.) So if we leave and it is left open, we get a notification and then close the garage. If putzing in the garage for an hour, I ignore the 6 notifications.

This has worked well for us for a number of years.

I can understand that, however, I would prefer it to close in case we forgot it. Sometimes we come home and just have our hands full with our daughter, our pets, groceries, whatever, and forget to close the door. I also don’t want to be the neighborhood eyesore. Our neighbors frequently keep their garage open with all sorts of stuff on their lawn, so we have to look into their garage and see all their crap. I don’t want to do that to our neighbors on the other side. Like all modern garage doors, we have the beam sensor, so I’m not worried about it closing on us or anything.

We don’t do that through PLEG, instead we use the iPhoneLocator’s built in HouseModeActor variable. The only PLEG element we use in it thus far is for a GuestMode, which I’ve been tinkering with, and I think I have it, just need to test before our next guest or baby sitter comes over.

I may consider this, but for the above reasons, if my hands are full and I’m not paying attention to my phone, it’ll stay open until I get to my phone.

What I’ve come up with thus far, but haven’t tested yet. I spent quite a bit of time thinking about scenarios, and I think this should work for us.

Triggers:
tGarageOpen Whenever the Garage Door Opener is opened
tJenLocatorAway JensIPhoneLocator is away
tJenLocatorHome JensIPhoneLocator is present
tKeepGarageOpen Keep Garage Open is turned on
tTimLocatorAway TimsIPhoneLocator is away
tTimLocatorHome TimsIPhoneLocator is present

Conditions:
cGarageLeaving (( tTimLocatorHome; tTimLocatorAway ) OR ( tJenLocatorHome; tJenLocatorAway )) AND !tKeepGarageOpen

So if I’m Home, then I’m away, or the same conditions for my wife, and the virtual switch, KeepGarageOpen, is NOT set to True

cGarageArriving (( tTimLocatorAway; tTimLocatorHome ) OR ( tJenLocatorAway; tJenLocatorHome ))

Reverse conditions as cGarageLeaving. If I or my wife are away, then then come home

cGarageLeftOpen ( cGarageLeaving OR cGarageArriving ); tGarageOpen > 10:00

If either cGarageLeaving or cGarageArriving is true, and then the garage is left open for more than 10 minutes

Actions:
Action: cGarageLeftOpen
Garage Door Opener[174] SetTarget newTargetValue=0

Close the garage

I believe his should work, only when the home state changes. If I’m home, stay home, but open the garage door for whatever reason, it shouldn’t react.

Well, ran into the first bug. :frowning:

I’m getting the following warning:

Home Logic Programs[213] : ( cGarageLeaving OR cGarageArriving ); tGarageOpen < 10:00: attempt to compare two nil values

I’ve attached my status report

Not sure why that why I couldn’t combine the two states with a OR statement, but I separated them. That solved the immediate problem.

The problem I’m having now is that the condition to shut the door doesn’t seem to be working.

cGarageArrivingOpen cGarageArriving ; tGarageOpen > 15:00 false 2019-02-04 14:08:55.294 2019-02-04 15:42:53.313

I arrived home at 15:42. The garage door was opened and left open. The condition for my arrival was triggered, but after at 15:48.

cGarageArriving (( tTimLocatorAway; tTimLocatorHome ) OR ( tJenLocatorAway; tJenLocatorHome )) true 2019-02-04 15:48:55.253 0

I’m not sure how I would accommodate for the polling after the garage opening trigger. Any thoughts? I added an action for when the garage door opens to force refresh the iPhoneLocators, but again, that would mean it got updated after the fact.

More observations…

My conditions for leaving and arriving seem to leave the state as True when it happens, so long as the opposite conditions hasn’t happened yet (arriving to leaving, leaving to arriving).

[table]
[tr]
[td]Name[/td]
[td]Logic Expression[/td]
[td]Value[/td]
[td]Last True (or Last Change)[/td]
[td]Last False (or Previous Change)[/td][/tr]
[tr]
[td]cGarageLeaving[/td]
[td](( tTimLocatorHome; tTimLocatorAway ) OR ( tJenLocatorHome; tJenLocatorAway )) AND !tKeepGarageOpen[/td]
[td]true[/td]
[td]2019-02-05 06:43:25.357[/td]
[td]2019-02-04 16:01:52.256[/td]
[/tr]
[tr]
[td]cGarageArriving[/td]
[td](( tTimLocatorAway; tTimLocatorHome ) OR ( tJenLocatorAway; tJenLocatorHome ))[/td]
[td]false[/td]
[td]2019-02-04 15:48:55.253[/td]
[td]2019-02-05 06:46:27.291[/td]
[/tr]
[/table]

That, in itself, could potentially solve my problem where my locator state comes true AFTER I’ve opened the garage, as it’ll remain true, and I can use an AND operator, and not the sequence semicolon. The problem is, if I’m home, and go to open the garage again, it’ll still show as the “arriving” state, and go to close it again. Not such a problem when leaving, and I want to ensure the garage door is closed if I forgot to close it, but I don’t necessarily want it to close on me again if I open it after I’ve closed it. The time condition would attempt to close it again immediately. In theory, it could also cause a problem when I come home, and the locator state hasn’t updated yet, and still shows the depart state as true. As soon as I open the garage door, it’ll see it’s in the depart state, and close it immediately as well.

One other issue with the Arriving and Departing state staying True, is that I would like to use the arrival/departure state as a trigger to change the polling. In theory, if I arrive home, and the garage door is opened, I can change the polling of the iPhoneLocator to something much longer than the current 3 minute polling rate, to save both on battery state on the phones, as well as saving on inquiries to the Google API and potential associated costs.

[table]
[tr]
[td]Name[/td]
[td]Logic Expression[/td]
[td]Value[/td]
[td]Last True (or Last Change)[/td]
[td]Last False (or Previous Change)[/td][/tr]
[tr]
[td]cGarageLeavingOpen[/td]
[td]cGarageLeaving; tGarageOpen > 5:00[/td]
[td]false[/td]
[td]0[/td]
[td]0[/td]
[/tr]
[tr]
[td]cGarageArrivingOpen[/td]
[td]cGarageArriving ; tGarageOpen > 15:00[/td]
[td]false[/td]
[td]2019-02-04 14:08:55.294[/td]
[td]2019-02-04 15:42:53.313[/td]
[/tr]
[/table]

Last night I purposefully left the garage open after I got home, I think the sequence operator didn’t work properly, because the iPhoneLocator polling updated after I opened the garage.

Anybody have any thoughts on how I can solve these problems?

My latest status report is attached, in addition to the tables I’ve included.

A little more work, thoughts…

One thing I noticed, is that even iPhoneLocator isn’t 100% great at updating the my location, and it’s not just limited to Vera and it’s Geofenching. As I’ve been working on this issue this week, I’ve had to manually force my iPhoneLocator instance to refresh to change my location to the Present state. When I used the app in the past (2-3 years ago), I don’t recall this being an issue, however, I believe my polling rate was much shorter…maybe 60 seconds, and not 3 minutes as it is now. The reason for the 3 minutes now of course is the Google Maps API not being free, and not wanting to go over the free instance limit.

This had me thinking about the problem, and possible solutions, which would potentially solve the immediate Garage arriving/departing problem, but also ensure that the API billing isn’t a problem. I was thinking of using any exterior door as a trigger, to change the polling interval to 1 minute, for 10 or 15 minutes. This would ensure that the locator app is being refreshed properly.

[ul][li]If, after the 10 or 15 minute period, the Present state is true, change the polling interval to something large, like an hour, or even disable the polling, until an exterior door is opened again. If I’m home, there is no way my location is going to change without a door being opened, unless I either develop transporter technology or crawl out a window. :P[/li]

[li]If after the 10-15 minute period, Present is false, I can change the polling period to 3 minutes, and let the iPhoneLocator’s polling technique kick in based upon distance, or come up with my own version.[/li][/ul]

What I’m not sure is the best approach to this. Setting a trigger is no problem, but I’m having problems coming up with the conditions for the 10-15 minute period. My current status pdf is in the previous post.

I got it working, after much playing around. I ended up having to make the conditions a bit more complicated than I originally did, using the NOW operator in them to make it work. There may be more elegant ways of making this work, but I’m happy for now.