#21069 - 05/06/09 06:18 PM
Help code newbie with Timer...
|
sbessel
newbie
Registered: 02/04/04
Posts: 21
Loc: Folsom, CA.
|
Greetings...
I have had my Ocelot and 2 SECU16's running for ~6 years, all being used only by HomeSeer with no CMAX code.
I recently added a 3rd SECU16 to control my pool equipment. I am using the following CMAX program to control the remote switches I have at the box, and HomeSeer to control the automatic on/off schedule.
What I want to do is have 2 more functions.
1> Be able to turn off the pool sweep (Module #3 SECU16 Relay #10) if for any reason Module #3 SECU16 Relay #8 or Module #3 SECU16 Relay #9 are off or turn off
2> Place a hard max-on timer on each relay. I.E. Module #3 SECU16 Relay #8 can only be on for a max of 12 hours. Regardless of who turned it on.
Would this be posible? I am a code newbie, and it took me a few versions just to get the stuff below working right.
0001 - IF Module #3 -SECU16 Input #0 Turns ON //
0002 - AND Module #3 -SECU16 Relay #8 Is OFF //
0003 - THEN Module #3 -SECU16 Relay #8 Turn ON //
0004 - IF Module #3 -SECU16 Input #0 Turns ON //
0005 - AND Module #3 -SECU16 Relay #8 Is ON //
0006 - THEN Module #3 -SECU16 Relay #8 Turn OFF //
0007 - IF Module #3 -SECU16 Input #1 Turns ON //
0008 - AND Module #3 -SECU16 Relay #9 Is OFF //
0009 - THEN Module #3 -SECU16 Relay #9 Turn ON //
0010 - IF Module #3 -SECU16 Input #1 Turns ON //
0011 - AND Module #3 -SECU16 Relay #9 Is ON //
0012 - THEN Module #3 -SECU16 Relay #9 Turn OFF //
0013 - IF Module #3 -SECU16 Input #2 Turns ON //
0014 - AND Module #3 -SECU16 Relay #10 Is OFF //
0015 - THEN Module #3 -SECU16 Relay #10 Turn ON //
0016 - IF Module #3 -SECU16 Input #2 Turns ON //
0017 - AND Module #3 -SECU16 Relay #10 Is ON //
0018 - THEN Module #3 -SECU16 Relay #10 Turn OFF //
0019 - IF Module #3 -SECU16 Input #5 Turns ON //
0020 - THEN Module #3 -SECU16 Relay #8 Turn OFF //
0021 - THEN Module #3 -SECU16 Relay #9 Turn OFF //
0022 - THEN Module #3 -SECU16 Relay #10 Turn OFF //
0023 - End Program //
Thanks!
Scott
|
|
Top
|
|
|
|
#21070 - 05/06/09 06:31 PM
Re: Help code newbie with Timer...
[Re: sbessel]
|
sbessel
newbie
Registered: 02/04/04
Posts: 21
Loc: Folsom, CA.
|
In case anyone is interested here are a couple of pictures:
 Scott
|
|
Top
|
|
|
|
#21071 - 05/06/09 06:50 PM
Re: Help code newbie with Timer...
[Re: sbessel]
|
Guy Lavoie
Beyond All Hope
   
Registered: 12/21/02
Posts: 6401
Loc: Montreal, QC, Canada
|
Since it is possible to directly test the status of an output relay, you could just code your functions something like this:
"1> Be able to turn off the pool sweep (Module #3 SECU16 Relay #10) if for any reason Module #3 SECU16 Relay #8 or Module #3 SECU16 Relay #9 are off or turn off"
IF Module #3 -SECU16 Relay #8 Turns OFF // OR Module #3 -SECU16 Relay #8 Turns OFF // THEN Module #3 -SECU16 Relay #10 Turn OFF //
To also test for a static off condition requires keeping track of status with a flag variable, to avoid jamming the bus with constant relay on or off commands, such as:
IF Module #3 -SECU16 Relay #8 Is OFF // AND Module #3 -SECU16 Relay #9 Is OFF // AND Variable #1 = 0 //if flag is not yet set THEN Module #3 -SECU16 Relay #10 Turn OFF THEN Variable #1 = 1 //set the flag too
IF Module #3 -SECU16 Relay #8 Is ON // OR Module #3 -SECU16 Relay #9 Is ON // THEN Variable #1 = 0 //reset the flag
This way, any time one of the two outputs is turned on, the flag gets reset, and whenever both outputs are off for a first time, Relay 10 is turned off and the flag is set.
"2> Place a hard max-on timer on each relay. I.E. Module #3 SECU16 Relay #8 can only be on for a max of 12 hours. Regardless of who turned it on."
IF Module #3 -SECU16 Relay #8 Turns ON // THEN Timer #1 = 1 //start timer
IF Module #3 -SECU16 Relay #8 Turns OFF // THEN Timer #1 = 0 //stop timer
IF Timer #1 becomes > 43200 //if ON more then 12 hours THEN Module #3 -SECU16 Relay #8 Turn OFF //turn off relay
_________________________
"If you don't know what you're doing, do it neatly..."
|
|
Top
|
|
|
|
#21072 - 05/06/09 07:14 PM
Re: Help code newbie with Timer...
[Re: Guy Lavoie]
|
sbessel
newbie
Registered: 02/04/04
Posts: 21
Loc: Folsom, CA.
|
That is great help. I think this functionality really adds to my system, and will help if (or should I say when) HS crashes as it won't leave any part of my pool on for longer than needed.
I have another question, if my HS system turns off an already off relay will it trigger a "Turn Off" event?
Is there any limitation to timers that I will run into with this? (possibly having 2 running at the same time)
Also is the CMAX code documented anyplace? I couldn't find it.
Is there also a way to test stuff like this? Perhaps an emulator? I can see issues trying to test the timers and such...
thanks...
Scott
Edited by sbessel (05/06/09 08:01 PM)
|
|
Top
|
|
|
|
#21075 - 05/07/09 05:19 PM
Re: Help code newbie with Timer...
[Re: Guy Lavoie]
|
sbessel
newbie
Registered: 02/04/04
Posts: 21
Loc: Folsom, CA.
|
great... but I seem to be missing the links 
HomeSeer only reads variables and I would like to view the current timers (runtime) but I am unable to find out how to set a variable = timer.
is this possible?
Scott
|
|
Top
|
|
|
|
#21077 - 05/07/09 05:47 PM
Re: Help code newbie with Timer...
[Re: Guy Lavoie]
|
sbessel
newbie
Registered: 02/04/04
Posts: 21
Loc: Folsom, CA.
|
well fine... if you want to make it easy for me
|
|
Top
|
|
|
|
Moderator: Dan Smith, Monte G, ADI Tech Support, Guy Lavoie
|
2747 Members
19 Forums
3837 Topics
22713 Posts
Max Online: 67 @ 08/16/11 03:08 PM
|
|
|
|
|
|
1
|
2
|
3
|
4
|
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
|
12
|
13
|
14
|
15
|
16
|
17
|
18
|
|
19
|
20
|
21
|
22
|
23
|
24
|
25
|
|
26
|
27
|
28
|
29
|
|
|
|
|
|