Countdown Timer: Difference between revisions

From Universal Devices, Inc. Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(7 intermediate revisions by the same user not shown)
Line 4: Line 4:


Here’s what a user can do;
Here’s what a user can do;
1) Turn a responder on, off or dim as usual using any KeyPadLinc or SwitchLinc button.
# Turn a responder on, off or dim as usual using any KeyPadLinc or SwitchLinc button.
2) Put the responder in timer mode by double-tapping the button.
# Put the responder in timer mode by double-tapping the button.
3) Increase the remaining time by double-tapping multiple times.
# Increase the remaining time by double-tapping multiple times.


You will see below that the minutes remaining has been hard coded as 30 (in [Fan Increment], Then section).  However this could be replaced with a variable so it could be altered via the web interface.
You will see below that the minutes remaining has been hard coded as 30 (in [Fan Increment], Then section).  However this could be replaced with a variable so it could be altered via the web or MobiLinc interface.


In my example, I’m watching two switches, one upstairs and one downstairs.  Whether the fan is currently on or off, a double click (from either location) turns it on and starts the timer decrementing.  When the decrementing code times out, the fan is turned off.   
In my example, I’m watching two switches, one upstairs and one downstairs.  Whether the fan is currently on or off, a double tap (from either location) turns it on and starts the timer decrementing.  When the decrementing code times out, the fan is turned off.   


Note that to detect button presses, individual devices must be checked.  But for proper display status (if you have multiple controls linked), a scene must be used to ensure that all responders display the correct status.
Note that to detect button presses, individual devices must be checked.  But for proper display status (if you have multiple controls linked), a scene must be used to ensure that all responders display the correct status.
Line 19: Line 19:
   
   
'''Fan Increment;'''
'''Fan Increment;'''
  If
  If   ;When either button is double-tapped
            Control 'Upstairs / HouseFan'   is switched Fast On
        Control 'Upstairs   / HouseFan' is switched Fast On
        Or  Control 'Upstairs / HouseFan'   is switched Fast Off
    Or  Control 'Upstairs   / HouseFan' is switched Fast Off
        Or  Control 'Downstairs / HouseFan' is switched Fast On
    Or  Control 'Downstairs / HouseFan' is switched Fast On
        Or  Control 'Downstairs / HouseFan' is switched Fast Off
    Or  Control 'Downstairs / HouseFan' is switched Fast Off
    Then
Then
        Set Scene 'House Fan' On
    Set Scene 'House Fan' On
        SFan_Minutes += 30
    $Fan_Minutes += 30
        Run Program 'Fan Decrement' (If)
    Run Program 'Fan Decrement' (If)
    Else
Else
        - No Actions - (To add one, press 'Action')
    - No Actions - (To add one, press 'Action')
   
   
'''Fan Decrement;'''
'''Fan Decrement;'''
    If
If
        $Fan_Minutes > 0
    $Fan_Minutes > 0
     Then
  Then
        $Fan_Minutes -= 1
     Wait  1 minute
        Wait  1 minute
    $Fan_Minutes -= 1
        Run Program 'Fan Decrement' (If)
    Run Program 'Fan Decrement' (If)
    Else
Else
        Set Scene 'House Fan' Off
    Set Scene 'House Fan' Off
   
   
'''Fan Stop Now;'''
'''Fan Stop Now;'''
    If
If
            Control  'Upstairs / HouseFan'   is switched Off
        Control  'Upstairs   / HouseFan' is switched Off
        Or Control  'Downstairs / HouseFan' is switched Off
    Or Control  'Downstairs / HouseFan' is switched Off
    Then
  Then
        $Fan_Minutes = 0
    $Fan_Minutes = 0
        Set Scene 'House Fan' Off
    Set Scene 'House Fan' Off
        Stop program 'Fan Decrement'
    Stop program 'Fan Decrement'
    Else
Else
        - No Actions - (To add one, press 'Action')
    - No Actions - (To add one, press 'Action')
   
   
Please let me know if you find any anomalies or can improve functionality.
Please let me know if you find any anomalies or can improve functionality.


Cheers, BitSmith.
Cheers,
--[[User:BitSmith|BitSmith]] ([[User talk:BitSmith|talk]])





Latest revision as of 19:02, 29 June 2013

When it's hot, I like to go to sleep with the whole house fan on. But there are nights I want it to stay on for a long time, and others when I want it on for just a bit. In my search for an easy solution, I found an article from four years ago (thanks to rob9 for that). I've rewritten using some of ISY's improvements, i.e. variables.

My need is to control a whole-house fan.

Here’s what a user can do;

  1. Turn a responder on, off or dim as usual using any KeyPadLinc or SwitchLinc button.
  2. Put the responder in timer mode by double-tapping the button.
  3. Increase the remaining time by double-tapping multiple times.

You will see below that the minutes remaining has been hard coded as 30 (in [Fan Increment], Then section). However this could be replaced with a variable so it could be altered via the web or MobiLinc interface.

In my example, I’m watching two switches, one upstairs and one downstairs. Whether the fan is currently on or off, a double tap (from either location) turns it on and starts the timer decrementing. When the decrementing code times out, the fan is turned off.

Note that to detect button presses, individual devices must be checked. But for proper display status (if you have multiple controls linked), a scene must be used to ensure that all responders display the correct status.

A single variable, “Fan_Minutes” describes the remaining time on the counter.

Three program entry points are simple to follow;

Fan Increment;

If    ;When either button is double-tapped
        Control 'Upstairs   / HouseFan' is switched Fast On
    Or  Control 'Upstairs   / HouseFan' is switched Fast Off
    Or  Control 'Downstairs / HouseFan' is switched Fast On
    Or  Control 'Downstairs / HouseFan' is switched Fast Off
Then
    Set Scene 'House Fan' On
    $Fan_Minutes += 30
    Run Program 'Fan Decrement' (If)
Else
    - No Actions - (To add one, press 'Action')

Fan Decrement;

If
    $Fan_Minutes > 0
 Then
    Wait   1 minute
    $Fan_Minutes -= 1
    Run Program 'Fan Decrement' (If)
Else
    Set Scene 'House Fan' Off

Fan Stop Now;

If
       Control  'Upstairs   / HouseFan' is switched Off
    Or Control  'Downstairs / HouseFan' is switched Off
 Then
    $Fan_Minutes = 0
    Set Scene 'House Fan' Off
    Stop program 'Fan Decrement'
Else
    - No Actions - (To add one, press 'Action')

Please let me know if you find any anomalies or can improve functionality.

Cheers, --BitSmith (talk)



Original Article: http://wiki.universal-devices.com/index.php?title=ISY-99i/ISY-26_INSTEON:Programs_as_Variables:_SwitchLinc_Emulates_Countdown_Timer


ISY-99i Series INSTEON : How-To Guide