Program code examples for the JDS timcommander





last updated 8/18/99

I am currently working on getting my two RCS bidirectional thermostats to function the way I want. Any code examples you care to send I will post here.

Security





My security routines I won't publish here for obvious reasons. The security routine is to first shut down the house then set HVAC and lighting too away status and finally sets the alarm. This includes all lights and modules. The HVAC is put in set back mode. I have several routines that provide a safety net for the house if it gets too hot or too cold for any reason. The lighting security routine is activated and log entries are made. Each time the external motion detector are trigger a log entry is made. Finally the pre alarm is sounded and the alarm system is set.

I really like the part about shutting down the house. My house is two stories and at last count has over 50 lights. You can count on some them being left on at all times. More on how I deal with that problem later.



DOGS IN THE GARAGE ROUTINES


I have 2 large dogs that like to get muddy and like to run around the neighborhood. To keep my carpet clean, my wife happy and my dogs at home I wrote this routine to disable the garage door opener while the dogs are in there. The routine sounds the beeper to verify that the command has been received and the door disabled. The second routine beeps a beeper I have in the kitchen every 2 sec every 5 min while the door is disabled. I hate to drive up in the rain and not have the garage door working because someone forgot they had turned it off.

The m-11 on lights the LED on the keypad next to the switch.
The garage door is plugged into an appliance module addressed to h-3.
The relay command is where the radio shack beeper is hooked up. I brought one that does both steady and pulsed beeps. So I can use the different sounds to mean different things.

EVENT: Dogs in the garage  
  If 
    XSEQ:( M-11 M-OFF ) Received within 3 seconds [Receive Only] 
  Then 
    X10:  (H-3  Garage Door ctrl) OFF 
    (T:Garage door off) LOAD with 0:05:00 
    X10:  (M-11  kitchen pb3) ON 
    (RELAY:alert-beep) ON  
    DELAY  0:00:02 
    (RELAY:alert-beep) OFF  
  End 
    
  EVENT:  Dogs in garage alert 
  If 
    (T:Garage door off) is Expiring 
  Then 
    (RELAY:alert-beep) ON  
    DELAY  0:00:03 
    (RELAY:alert-beep) OFF  
    (T:Garage door off) LOAD with 0:05:00 
  End 

HVAC





Night time HVAC fan run routine


This routine I am very happy with. I found that the house (bedroom) was getting stuffy at night. (I have a routine that actually shuts down the HVAC during the spring and fall). I had to do something or install a ceiling fan. I have hated ceiling fans in my bedroom ever since I put my hand in one while putting on a t-shirt. It's function is to run the fan on both the up and downstairs HVAC for :15 every hour after midnight and before 6am. To get it to work I ended up having to set the timer for :45 and then use a delay of :15 in the then macro to get my hour spacing.
EVENT:  Fan run routine 
  If 
    Time is 12:01 AM SMTWTFS 
      -OR- 
    (T:Fan timer) is Expiring 
  Then 
    If 
      Time is After 6:00 AM SMTWTFS 
    Then 
      (T:Fan timer)  STOP  
      (T:UP FAN TIMER)  STOP  
    Else 
      (THEN MACRO:Run/deay fan) 
      (THEN MACRO:UP RUN FAN) 
   
     Nest End 
  End 

THEN Macro: Run/deay fan 
  MACRO BEGIN   
    X10:  (J-4  rcs commands) PRE-Set Level  13 % 
   * Frozen *   LOG 'fan run ' 
    DELAY  0:15:00 
    X10:  (J-4  rcs commands) PRE-Set Level  16 % 
    (T:Fan timer) LOAD with 0:45:00 
  MACRO END 

THEN Macro: UP RUN FAN 
  MACRO BEGIN   
    DELAY  0:00:03 
    X10:  (K-4  up commands) PRE-Set Level  13 % 
    DELAY  0:15:00 
    X10:  (K-4  up commands) PRE-Set Level  16 % 
    (T:UP FAN TIMER) LOAD with 0:45:00 
  MACRO END 

>

Power Failure




Temperture Loging


This code sample is used for logging the default thermostat temp set point, the actual temp as read from the RCS thermostats and what the actual set point is ( in case someone has manually changed it). I added a temp sensor in the attic and one outside so I added code to log that reading also. The entries are found in the message log. I use this for debugging the code and to monitor the HVAC system. I have even imported the log into excel and produced a graph of the temp/time of the house.I change the timer to a shorter time when I am troubleshooting the JDS or RCS thermostats. I then set it for longer when I just want to keep a daily log. I added a log of the attic and outside temp. when I added the two sensors for these areas. I actually look at these two temps more then I do the inside entries.

The dn setpoint is the default set point that the jds would set the thermostats to.
The current sp dn is the current set point. I log this in case someone has changed a thermostat manually.
The current temp dn is the actual temperture in the house as taken from the bidirectional thermostat.
EVENT:  log heat 
  If 
    (T:temp log timer) is Expiring 
  Then 
 
    (V:current temp-dn) Load with (HVAC:downstairs ther Temperature ) 
    DELAY  0:00:01 
    (V:current sp dn) Load with (HVAC:downstairs ther Setpoint ) 
    (V:current up temp) Load with (HVAC:up thermostat Temperature ) 
    (V:current up sp) Load with (HVAC:up thermostat Setpoint ) 
    " dn-sp/current sp/current temp-up " 
    LOG '(dn setpoint) /(current sp dn) /(current temp-dn)^(up setpoint)/(current up sp)/(current up temp)' 
    LOG 'attic temp (attic temp)- outside temp (out tm)' 
    (T:temp log timer) LOAD with 1:00:00 
  End 


This code sample logs to the message log the highest and lowest temp for the attic and outside temp sensor. The high and low are written every morning to the message log and the values are reset. .

 EVENT:  ATTIC HIGH AND LOW LOG 
  If 
     Sunrise SMTWTFS 
      -OR- 
     (T:attic temp timer) is Expiring 
  Then 
    If 
      (T:attic temp timer) is Expiring 
    Then 
      If 
        (V:ATTIC HIGH)> (A/D:attic temp) 
      Then 
        (V:ATTIC HIGH)  LOAD with (A/D:attic temp) 
      Nest End 
      If 
        (V:outside high) < (A/D:out tm) 
      Then 
        (V:outside high)  LOAD with (A/D:out tm) 
      Nest End 
      If 
        (V:ATTIC LOW) > (A/D:attic temp) 
      Then 
        (V:ATTIC LOW)  LOAD with (A/D:attic temp) 
      Nest End 
      If 
         (V:outside low) > (A/D:out tm) 
      Then 
         (V:outside low)  LOAD with (A/D:out tm) 
       Nest End 
         (T:attic temp timer) LOAD with 1:00:00 
    Else 
       LOG 'DAILY TEMPS OUT (outside low)/(outside high)-ATTIC (ATTIC LOW)/(ATTIC HIGH)' 
      (V:ATTIC HIGH)  LOAD with (A/D:attic temp) 
      (V:ATTIC LOW)  LOAD with (A/D:attic temp) 
      (V:outside high)  LOAD with (A/D:out tm) 
      (V:outside low)  LOAD with (A/D:out tm) 
      (T:attic temp timer) LOAD with 1:00:00 
    Nest End 
  Else 
  End 
    



Analog temperture sensor (To prevent false readings)This code sample was suggested by Jeff at JDS to avoid the problem with analog temp. sensors giving false readings. The sensors tend to jump around. This code takes two readings 3:00 apart and compares them. If they are the same then the value is passed to the variable "cur outside tem" which is used by the controller. So the reading has to be stable for 3 min. before the controller is allowed to act on it.
EVENT:  To read and verify outside temp 
  If 
    (V:test outside tem) != (A/D:out tm) 
  Then 
    LOG '(test outside tem) test,  outside=(out tm),(then1)' 
    (V:test outside tem)  LOAD with (A/D:out tm) 
    DELAY  0:03:00 
    If 
      (V:test outside tem) = (A/D:out tm) 
    Then 
      LOG '(cur.outside temp)cur out  temp,outside=(out tm)(then 2)' 
     (V:test outside tem)  LOAD with (A/D:out tm) 
     (V:cur.outside temp)  LOAD with (V:test outside tem) 
     Nest End 
  End 



Return to Putnam Estate Home Automation Page 1