Jump to content
AT&T to end email-to-text ×

Wait variable minutes


hart2hart

Recommended Posts

Posted (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 by Guy Lavoie
Posted (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 by larryllix

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...