hart2hart Posted 12 hours ago Posted 12 hours ago is there a way to wait the number of minutes stored in an integer variable? Quote
Guy Lavoie Posted 11 hours ago Posted 11 hours ago (edited) No, not as a Wait statement, within a single program. But you can do it if you break it up into more than one program. I have my bathroom fan timer set up like that. For example, you want to perform Action B a number of minutes after Action A, where the number of minutes is in variable "i_wait". In this example s_timer is a status variable. If original trigger condition Then Action A Then s_timer = 1 If s_timer > i_wait Then Action B Then s_timer = 0 If s_timer > 0 Then s_timer +=1 Then Wait 1 minute The third program is the "timer", incrementing by 1 every minute, as long as the s_timer is set to any value above 0. Edited 10 hours ago by Guy Lavoie Quote
larryllix Posted 9 hours ago Posted 9 hours ago (edited) This is how I did it with two programs. Any program wanting to start the time just sets the state variable, $sHouse.countdowner, to X minutes and the rest happens automatically. After the timeout the house is marked as unoccupied. Note usage of constant integers. Occupied.countdowner - [ID 0167][Parent 000B][Run At Startup] If $sHouse.occupied.timer > 0 And From 9:30:00AM To 11:00:00PM (same day) // [Run at Startup] enabled Then Wait 1 minute $sHouse.occupied.timer -= 1 Else - No Actions - (To add one, press 'Action') Self retriggering timer. -If startup occurs outside wake timeframe, will self start at beginning of timeframe. -If timeframe commences while .timer is 0, first new occupied.timer value will start again. Occupied.flagger - [ID 0168][Parent 000B] If $sHouse.occupied.timer > 0 Then $sHouse.occupied = $cTRUE Else $sHouse.occupied = $cFALSE Power up assumes home unoccupied! Shouldn't be long to correct that. Program cannot be combined into "Occupied countdowner" program as it's timeframe end would zero occupied.timer Edited 8 hours ago by larryllix Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.