Here is my, should be a very simple, PLEG setup. I set this up just to test one outlet on the porch for the holiday month of December. No luck figuring out the LUA to insert into PLEG for ONLY one month every year so I simplified it even more. I watched the time on the VERA PLUS and set the PLEG to trigger about two-three minutes after the current time and saved the VERA before the time was reached. I also made the assumption that even though the schedule ended I needed an “off” condition as well. This doesn’t even turn the outlet on. I did test the outlet using the Vera and it does function. What am I doing wrong.
You really need to include a copy of the Status Report if you want a reply from RTS.
Go to Editor Options and print a pdf, then attach it to this thread.
Shouldn’t be very difficult. I’m setting up the same thing so I’ll post what I end up with…
Ok, I started with JUST the schedule. Set start time for ABSOLUTE, 12/05/, 14:00:00 and end time as ABSOLUTE, 12/05/, 22:30:00. Saved, restarted LUA and even rebooted Vera. 2pm rolls around, schedule still false. I’ve got other schedules that run daily at certain times and they all function just fine. I have a condition and an action for this one but since the schedule doesn’t seem to activate, the rest is irrelevant. Hopefully someone can point out the issue here so that myself and the other person trying to do this can learn from it. Thanks!
I will setup a test and check this …
I found two problems with Absolute Timers … I guess I never tested this … and no one ever reported as an error!
-
The formatted string for date is wrong, Vera Requires YYYY-MM-DD (Not MM/DD/YY)
For every year YYYY can be set to * -
There was a bug in the code.
I will make a release later today.
Thanks! The reason it hasn’t been reported is probably because not many people use it. I’m glad you chose to include it as an option though and look forward to the fix.
Thanks for finding and fixing, oddly I use Absolute timers but in UI5, so until I completely update to UI7 (I doubt that will ever happen) I would have never found the problem. Odd though, works in UI5 & not in UI7?
In UI5 … I think it will always trip at midnight, independent of what you use for the time.
Also, because of a Vera Bug, the timer will trip to true, with potential actions being run, continuously for 1 second.
Any idea when the fix for this will be available? I know you said you’d make a release, but that doesn’t mean MCV will make it readily available…
We are on MCV time …
I figured… I just need it for Christmas day. Can’t have the granddaughter get up to find the tree not all lit up! Worst case, I’ll do it the hard way…
I ended up just setting up a scene with the “sunrise/sunset” device app. to come on at sunset. Then I put the following LUUP code into the LUUP section of the scene:
local mdStart = “12/01” – Start of period (MM/DD)
local mdEnd = “12/31” – End of period (MM/DD)
local allow = true – true runs scene during period, false blocks it
local smS, sdS = string.match(mdStart,“(%d+)%/(%d+)”)
local smE, sdE = string.match(mdEnd,“(%d+)%/(%d+)”)
local mS = tonumber(smS)
local dS = tonumber(sdS)
local mE = tonumber(smE)
local dE = tonumber(sdE)
local tNow = os.date(“*t”)
local mN = tNow.month
local dN = tNow.day
if (mE > mS) or ((mE == mS) and (dE >= dS)) then
return (((mN > mS) or ((mN == mS) and (dN >= dS))) and ((mN < mE) or ((mN == mE) and (dN <= dE))) == allow)
else
return (((mN > mS) or ((mN == mS) and (dN >= dS))) or ((mN < mE) or ((mN == mE) and (dN <= dE))) == allow)
end
This sets the scene to “allow” to run between 12/01 and 12/31. You can change it to whatever dates you want. I tested both the on and off scenes withing those dates and then tried a month that was different and they worked great. PLEG is yet one more learning curve. While I haven’t found any real good training that includes both VERA and LUUP there are many pieces. I will continue to learn LUUP instead of PLEG. I DO miss my I.B.M. GUI version of Home Director for my old X10 devices. It had everything and it was just point and click. Maybe someday I’ll have time to develop a similar GUI for Vera!
Thanks for this little snippet of code. I’m not a LUA person at all but I can figure out how this works. ;D Always nice to see working code and to be able to learn from it…
The latest Version of PLEG has been accepted by MCV and has the fix for absolute timers that fire every year.
Bring on the Holidays (Festivus is coming on the 23rd) , Anniversaries, Birth Days, …
Good deal. Now if they’ll allow the update to go out… ;D