PurdueGuy, this is extactly what I was thinking. Just a random addition to the initial countdown value.
In this example, imagine that you have a bathroom with a door sensor, a motion sensor and a light switch. You want the light to go on when the door opens, and to go off one minute after the door closes, unless motion was detected during that minute (in this case, the light stays on indefinitely).
- Create a Countdown Timer. Rename it One minute timer. Go to the configuration tab and change the Duration to 60 seconds.
- Create a scene. Rename it Door opened. Edit the scene, setting a trigger for the door sensor device: A sensor (door/window/motion/etc.) is tripped > Device is tripped. Make the scene activate the Cancel button on the One Minute Timer. Also make the scene turn the light on.
- Create a second scene. Rename it Door closed. Edit the scene, setting a trigger for the door sensor device: A sensor (door/window/motion/etc.) is tripped > Device is not tripped. Make the scene activate the Restart button on the One Minute Timer.
- Create a third scene. Rename it Motion detected. Edit the scene, setting a trigger for the motion sensor device: A sensor (door/window/motion/etc.) is tripped > Device is tripped. Make the scene activate the Cancel button on the One Minute Timer.
- Create a fourth scene. Rename it Turn light off. Edit the scene, setting a trigger for the One Minute Timer: Timer completes while not muted. Make the scene activate the Off button on the light device.
Mute the timer to temporarily override the automatic turning off of the light.
I am having trouble with this. For some reason on every scene that I use to set or cancel a timer once I save it and reopen, the start or cancel button is not selected anymore. The only button I can get to “stick” is the mute and unmute buttons. I tried in two browsers, any ideas?
M
EDIT
Nevermind, found this post [url=http://forum.micasaverde.com/index.php/topic,9425.msg63555.html#msg63555]http://forum.micasaverde.com/index.php/topic,9425.msg63555.html#msg63555[/url]
Does this countdown survive a power loss/reboot?
M
Yes. Internally the plugin stores the timer-complete timestamp, not the remaining seconds, so it should be immune to losing time through any kind of misadventure, including a hard reboot. If the timer-complete timestamp elapses while the power is off, then the event will fire belatedly as soon as the plugin reloads.
Try it and see. If it fails, you found a bug!
I am trying to change the timer duration through lua code.
What is the correct syntax?
[quote=“drag0n, post:46, topic:170481”]I am trying to change the timer duration through lua code.
What is the correct syntax?[/quote]
I’ve never done it but it should be something like:
local theDeviceId = 123 -- change this
local theNewDuration = 30 -- change this
luup.call_action("urn:futzle-com:serviceId:CountdownTimer1", "SetTimerDuration", { newDuration = theNewDuration }, theDeviceId)
thanks!
I am now able to set up a countdown timer with a random timer.
local theDeviceId = 109 -- change this
local theNewDuration = math.random(10,20) -- create random # between 10 and 20
luup.call_action("urn:futzle-com:serviceId:CountdownTimer1", "SetTimerDuration", { newDuration = theNewDuration }, theDeviceId)
Hi,
I’m sucessfully using the countdown timer for alarm activation and desactivation.
It could be also cool to use it for light management.
Here it the idea : I want to have a push button to add 10 minutes of light by press.
For example, 3 press equal to 30minutes of lights on.
Actually, I need ot use some Lua code to achieve that.
I’m wondering it it could be achievable to add the “add/remove” second to the actions fields.
any way, thanks for this usefull plugin !
Hi Thomasss, it’s a neat idea. As you’ve noticed, the countdown timer plugin can’t do this now. You could do it with Luup code, adding seconds to the DueTimestamp variable. The plugin should pick up the extended timer immediately, even if it is counting.
I’ll have to think of the best way to incorporate a feature like this. There is enough clutter on the dashboard already.
I have a garage door sensor that tells me when the door is open or closed. How can I use the timer to send me a notification if the door is left open longer than ten minutes?
Scene 1
Trigger - door is opened
Action - start timer
Scene 2
Trigger - door is closed
Action - stop timer
Scene 3
Trigger - timer expired
Action - send notification (however you do it)
Perfectly logical on paper. But I’m stuck at the first step.
I don’t see how to tell the door sensor to start the timer when an armed sensor is tripped (open door).
Or how to tell an untripped sensor (closed door) to cancel the timer.
Hello Lonestar10,
This will give you a starting point from a previous thread.
http://forum.micasaverde.com/index.php/topic,10969.msg77430.html#msg77430
Thanks, Brientim.
Your explanation of setting up scenes was very helpful when I read it the first time. I have several scenes running…and now I have the garage notification scene working as well.
What was confusing me was that the drop-down dialog I was looking for is under the Advanced tab under Scenes. And that once I added a trigger, other dialog boxes appeared that were appropriate to the device, in this case, the timer.
Thanks again for everyone’s help. And thanks, Futzle, for a great app.
This and the Combination Switch/Trigger are great tools. I was able to create my own door-autolock mechanism that won’t autolock the door when the door is open. And using this, it appropriately takes two minutes before autolock.
The only issue (which I mentioned in another thread) is I need to be able to query the state of the lock in the combination switch for it to be useful in this scenerio. When I can, life becomes easy.
The Comboswitch conditions:
Door Closed AND Door Unlocked = Start Timer
Door NOT Closed OR Door Locked = Cancel Timer
This would allow me to not use any luup code at all. Right now, I have to add some door open/closed state checks to the triggers and scenes to ensure the timer isn’t running unnecessarily.
Here is the luup code I used before I had the timer plug-in:
[code]function deferLockScene(package)
if(lockInsecuredId == package) then
local veraUri = “urn:micasaverde-com:serviceId:HomeAutomationGateway1”
luup.call_action(veraUri , “RunScene”, {SceneNum = “1”}, 0)
end
end
lockInsecuredId = os.time() … “”
luup.call_timer(“deferLockScene”, 1, “1m”, “”, lockInsecuredId )[/code]
[tt]lockInsecuredId[/tt] ends up being a global variable that it compares the last time this was triggered to the package received by the timeout.
The Timer plug-in defintely makes this obsolete. But it may be interesting to others.
I need some guidance.
I am using the combination switch to monitor my door sensors and trigger the countdown timer. I have three scenes. Shutdown Air, Restart Air, Start Timer.
Combination switch triggers start timer. If it times out it starts Shutdown Air. When it resets it triggers Restart Air and Cancels Countdown Timer in the event that the timer has not timed out before the zones all reset and turn off combination switch.
The problem I have is that even though I select the countdown timer cancel button in Restart Air… it doesn’t seem to stay selected after I save and edit the scene.
I’m trying to figure out why, even though my zones reset before the timer finished my air still goes off.
Start here.[/quote]
Well that is good news and bad news. It explains the presentation change but makes me even more confused as to why my scenes are not running correctly. Hmmmm.