I have a time announcement on my Elk that runs every 30 minutes between 7am and 10pm. It says “The time is Seven Thirty A.M.”. But, it’s in the Elk’s crappy voice. I’m using Vera Alerts and have vera speaking throughout my house. I want to move the time announcement over to Vera, but it doesn’t look like there is a way through the GUI to tell it to do something on every hour and every half hour on the nose.
I’m assuming the only way to do this is Luup code, but also with some math to figure out if the time is a multiple of 1800 seconds. Or is there an easier way?
The schedules for scenes are really missing 1 level of specification.
You can specify for a certain time for every day.
You can specify for a repeating interval … but you can’t specify at what time you want the interval to start.
To get around this you can have a scene that triggers every minute.
Inside the LUUP code for the scene you can check to see if the minute is 0 or 15, or 30 or 45.
local Min = os.date("%M")
if ((Min = "00) or (Min == "15") or (Min == "30") or (Min == "45")) then
Do something here ...
end
if startTime <= endTime then
– Both the start time and the end time are in the same day:
– if the current time is in the given interval, run the scene.
if startTime <= currentTime and currentTime <= endTime then
luup.call_action(“urn:richardgreen:serviceId:VeraAlert1”, “SendAlert”,
{Message = “{tone:2}The current time is " … os.date(”%I:%M%p,“), Recipients = “”}, 46)
return true
end
else
– The start time is before midnight, and the end time is after midnight:
– if the current time is not outside the given interval, run the scene.
if not (endTime < currentTime and currentTime < startTime) then
luup.call_action(“urn:richardgreen:serviceId:VeraAlert1”, “SendAlert”,
{Message = “{tone:2}The current time is " … os.date(”%I:%M%p,”), Recipients = “”}, 46)
return true
end
end
Set timer to 1800 seconds (= 30 minutes)
create 3 scenes (it can be done in 2 but 3 is easier to create it for now)
scene 1 runs every day you want @ 7 AM (or a other time)
actions: unmute countdowntimer + start countdowntimer
scene 2 runs every day you want @ 10PM
actions: mute countdowntimer
scene 3 runs with trigger
trigger: unmuted countdowntimer is finished.
action: restart timer + the rest you want to do.
If you want the first action be taken at 7AM then you need to start scene 1 @ 6:30 AM
I hope this will get you in the right direction.
Best Home Automation shopping experience. Shop at Ezlo!