Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Timer Project Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: November 19 2004 at 06:17 | IP Logged Quote TonyNo

While at Radio Shack a bit ago, they had a combo pack of a lamp and appliance module plus a plug-in controller for $19. The controller needed a purpose.

A project I wanted to do was a timer for the kitchen. The idea was to have various buttons with different amounts of time for cooking, etc. I made an overlay for the controller for 5, 10, 15, 20, 25, 30, 45, 60 minute times, plus a Timer Cancel button.

I set the controller to house code P and added a few formula triggers like this...

ph_macroparm ( "TIMER", N, 0, 0, 0, 0 )

where N is 5, 10, etc.

and for the Cancel button...

ph_killmacrowait ( "TIMER" ) [PLUS] ph_tts("Timer cancelled")


Here is the macro called by the triggers...

Jump     if( ph_ismacrowaiting ( "TIMER" ) = 0, 3, 1)
Formula ph_playsound( "conf.wav", 0)
Jump     999
Formula ph_playsound( "processing.wav", 0)
Wait     number("[LOCAL1]") * 60
Macro    TEST WINAMP
Jump     if( {WINAMP STATUS} = 1, ph_macro("PLAY PAUSE"), 0)
Formula ph_playsound( "attention.wav", 0)
TTS      "The timer you set has expired!"
Jump     if( {WINAMP STATUS} = 1, ph_macro("PLAY PAUSE"), 0)


The macro receives the timer value in TEMP1, plays a confirmation sound, and waits the approprite amount of time. When the timer expires, the system announces the time complete. I also have the macro check if music is playing, and, if so, it pauses playback for the announcement, then, it restarts the music.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: November 21 2004 at 13:42 | IP Logged Quote dhoward

Tony,

That's a pretty cool idea. I like it.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
phil13
Groupie
Groupie
Avatar

Joined: December 19 2004
Location: France
Online Status: Offline
Posts: 60
Posted: December 20 2004 at 11:26 | IP Logged Quote phil13

Tony,

i've used your code to make a an autooff for my external light.

If my external radar detect something, it put the light ON and run the timer for 5 minutes.
Each time you are detected, the timer is killed (i don't now it is necessary) and is run again for 5 minutes.
After 5 minutes without detection, the timer end and the light is turn off.

I would like to improve it but i don't know how. Perhaps you could help me ...

How to see the current timer value (4', 3'10", ...) in a field ?

you said "made an overlay for the controller for 5, 10, 15, 20, 25, 30, 45, 60 minute times, plus a Timer Cancel button."

Is it possible to get the timer overlay by argument on a web page ?
On a web page, i enter for example 15 or 30 minutes for the timer and i click Enter.

I hope you have understood my french english ....

Thanks
Back to Top View phil13's Profile Search for other posts by phil13
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 20 2004 at 20:01 | IP Logged Quote dhoward

Phillipe,

Based upon what you want to accomplish, I don't think Tony's code would really apply. You would need a trigger, a macro, and a global variable to build a light that stays on for a user selectable amount of time after last seeing motion.

I would first create a global variable to hold the number of minutes you would like the light to stay on. In my example, I'll call this LIGHTMINUTES. You can create this in the PowerHome Explorer under Global Variables and we'll initially set this to 15.

I would next create the macro. In my example, I'll call it "MOTION LIGHT". The first thing you'll want this macro to do is check and see if it's already waiting. If it is, then extend the macro wait by the LIGHTMINUTES global variable. If it's not waiting, then we'll wait for the LIGHTMINUTES. After were done waiting, we'll just turn the light off. In my example, the light Im controlling will be A1. Below is the psuedocode for the "MOTION LIGHT" macro.

10     Jump     if(ph_ismacrowaiting("MOTION LIGHT") = 0,3,1)
20     Formula     Immediate     ph_extendmacrowait("MOTION LIGHT",[LIGHTMINUTES] * 60,0)
30     End Macro
40     Wait     [LIGHTMINUTES] * 60
50     X-10     A     1
60     X-10     A     OFF

I would next create a trigger for the ON (motion detected) for the motion sensor that you're interested in. Have the action for the trigger call the "MOTION LIGHT" macro.

And that should do it. You'll be able to change the number of minutes that the light stays on from the web by going into the stock PowerHome Global Variables screen.

Hope this helps,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum