Enjoying my new vera and happy I?ve found this forum.
I?m using vera alerts for when the garage or back door opens it plays a sound on my android device upstairs. That?s working fine. What I?m trying to do is to only play the sound during the hours of 8am to 10pm (so I don?t wake up the family if I leave early). I can?t seem to find a way to do this. Can some provide some thoughts on how to make this happen, if I have to use ?code?, samples would be greatly appreciated.
Thanks again
Take a look at Conditional Scene Execution. It includes an example that does just what you want.
When you get to more advanced automation, you would find the Program Logic Event Generator (PLEG) plugin a great help. See PLEG Basics for an introduction.
perfect! thanks!
In case it isn’t clear, this is how you could achieve a time-limit for your Vera Alerts:
Create a Vera scene that is triggered by the door being opened. Add Lua code that only allows the scene to run when you want (see examples) to the scene’s Luup tab. Add a SendAlert action to the scene for your Vera Alerts device.
I must still be missing something…
pasted in this code under the LUUP tab on the scene, but still sends alert at 17:30, just tested
local pStart = “07:30” – Start of time period
local pEnd = “21:00” – End of time period
local allow = false – true runs scene during period, false blocks it
local hS, mS = string.match(pStart,“(%d+)%:(%d+)”)
local mStart = (hS * 60) + mS
local hE, mE = string.match(pEnd,“(%d+)%:(%d+)”)
local mEnd = (hE * 60) + mE
local tNow = os.date(“*t”)
local mNow = (tNow.hour * 60) + tNow.min
if mEnd >= mStart then
return (((mNow >= mStart) and (mNow <= mEnd)) == allow)
else
return (((mNow >= mStart) or (mNow <= mEnd)) == allow)
end
Is there a place I can get some docs on lua coding and how it works, admin/user guide? It looks like it’s pretty powerful but I need some kick starting ![]()
Thanks agian
I must still be missing something.. pasted in this code under the LUUP tab on the scene, but still sends alert at 17:30, just testedDid you remove the original trigger for Vera Alerts? The Luup code will only block actions from the scene in which you placed it.
Is there a place I can get some docs on lua coding and how it works?The best starting place is [url=http://www.amazon.com/Programming-Third-Edition-Roberto-Ierusalimschy/dp/859037985X]Programming in Lua[/url]. There are some downloadable pdfs out there but buying the book helps to fund Lua development.
Sorry for the novice questioning,
The only trigger I have for Vera Alerts is within the scene where I have the luup code. When you mentioned
“Add a SendAlert action to the scene for your Vera Alerts device.” do you mean a trigger in the scene, or something else?
Again thanks for your patience, book is on order. Just hope i have enough basic understanding for it to be useful ![]()
[quote=“4vera, post:7, topic:179784”]Sorry for the novice questioning,
The only trigger I have for Vera Alerts is within the scene where I have the luup code. When you mentioned
“Add a SendAlert action to the scene for your Vera Alerts device.” do you mean a trigger in the scene, or something else?
Again thanks for your patience, book is on order. Just hope i have enough basic understanding for it to be useful ;)[/quote]
I just re-read your post:
I must still be missing something.. pasted in this code under the LUUP tab on the scene, but still sends alert at 17:30, just testedThe Lua code is set to allow the alert between 07:30 and 21:00 so it [u]should[/u] work at 17:30. Change the start and end times to suit your requirements.