Hi,
This is the code I use to check if my roller door is up at 6pm and if so, close it.
CloseGDoor1800 Weekly 18:00:00 1,2,3,4,5,6,7 None Interval 02:00
GDoorSensor I1.Garage Door Sensor CurrentLevel 0
(GDoorSensor > 50 and CloseGDoor1800)
I want to check it again 15m after sunset and although I can just add another schedule and a new condition line, is there are better way to keep the code clean?
[size=8pt]Vera 2 UI5, PLEG 7.31[/size]
How about a single schedule:
On at 18:00:00 and OFF at Sunset(rise) + 15:00
Then the condition would be:
GDoorSensor and ((GDoorSensor;Schedule) or (GDoorSensor; !Schedule))
Thank you so much. I’ll give that a whirl. I would have never been able to figure that one out!
Richard,
So I can learn, any chance you could briefly explain the code?
Then the condition would be:
GDoorSensor and ((GDoorSensor;Schedule) or (GDoorSensor; !Schedule))
The two time periods are handled by the OR condition.
The left side is one time period, when the Schedule Becomes true after the Garage Door is Open (and while it is still open).
The right side is the second time period, when the Schedule Becomes false, after the Garage Door is Open (and while it is still open).
The first period, schedule on is 18:00:00
The second period, schedule off is Sunset(rise) ± 15:00
Thank you so much. Still not quite sure about the !Schedule command as that means ‘NOT’ Schedule correct?
Sorry, one last question. Is the space between GDoorSensor; and !Schedule intentional or does it not matter? I get no script errors either way.
!Schedule is NOT Schedule when used generally in an expression.
However when used inside a sequence expression … !Schedule is the time stamp for when Schedule became false.
Space around operators is optional (Users choice).
Thanks, understood now.
Tried it last night by leaving door open and sure enough it closed at 1800, great. Opened it again around 1830 and waited for it to close at around 2015 (sunset +15) but it never did. Closed it manually then alas, this morning it opened itself at 0726. How do I figure that out? In my first post I mentioned sunrise +15 which was of course incorrect. I meant sunset +15.
P.S Not sure the timestamps in the PLEG/Vera reports are accurate?
Can’t see the whole status report … This looks like a PDF of a screen dump.
You need to PRINT the PDF file from the Status command window … there are plenty of free PRINT to PDF print drivers … try CutePDF
My bad. Didn’t have FF sent to ‘fit to screen’ before I printed to my writer. Updated copies attached. I noted two things today. It again closed last night at the correct time of 1800 but then opened again this morning and what I’m assuming was sunrise +15. This morning was backwards for two reasons. Opposite from sunset +15 and the condition is not checking the analogue value of the garage door sensor now which must be >50 indicating it is open.
The schedule does not match ANY time in status …
Are you clicking “Do IT NOW” ?
It’s still not a full report … no actions …
Doesn’y your DoorSensor device have a TRIGGER input, indicating it’s opened or closed (tripped?) ?
Otherwise you need a condition that indicates your door is open:
GarageDoorOpen GDoorSensor > 0
Then use GarageDoorOpen instead of GDoorSensor in your condition.
Thanks. Have added the trigger which makes more logical sense. Not quite sure about the “do it now” comment. What does that achieve? When I do that underneath the schedule tab, the door opens (or closes). With the new trigger now, that should prevent opening but why does it trigger at sunrise rather than at sunset +15 as per the schedule?
That’s why I want to see the STATUS report without you messing with the PLEG.
I think your Vera does not have it’s time set … and possibly it does not have the Location set properly (to get the right Time Zone).
Thanks but the time is displaying correctly and another PLEG that controls my watering system works flawlessly every morning albeit without sunset/sunrise schedules. The PLEG for the garage also closes correctly at 1800 everyday indicating the time is correct however I do suspect that anything relying on sunrise/sunset is all screwed up for some reason. Should I try using the day/night plugin instead?
Appears I’ve never waiting long enough for the country/region/lat/long to appear but having done that now, I get the error below. Maybe that is at Vera’s end?
Looks like my Vera is having issues saving the country and region info (NZ/Auckland) which of course determines the lat/long and subsequently the sunset/sunrise times. I’m assuming that without that it would default to GMT and as we are +13 GMT, maybe that explains the anomalies?
Looks like I’ve got this issue too. [url=http://forum.micasaverde.com/index.php/topic,30410.msg218244.html#msg218244]http://forum.micasaverde.com/index.php/topic,30410.msg218244.html#msg218244[/url]
After 38 tries and numerous reboots, location finally stuck! Let’s see how we go now.
I’m pleased to advise that it is running flawlessly now, thank you! For some reason, the two Vera2’s I have take an extremely long amount of time (>2m) to present the City and Region info in the time-zone page so it is easy to think that it is working if you do not know what supposed to be presented on that page.
I have the following conditions now:
GarageDoorOpen: GDoorSensor > 10
GarageDoorClosed: GDoorSensor < 10
CloseGDoor: GarageDoorOpen and ((GarageDoorOpen;GDoorSchedule) or (GarageDoorOpen;!GDoorSchedule))
I found I had to have the < and > values the same number in order for the logic to work. Creating GDoorSensor < 10 and GDoorSensor > 90 does not work.
The door now closes at 1800 or if opened again after that, at 15mins after sunset. Brilliant!