Turning on a device at a specific hour with a device trigger

Hi, i would like to make an advance scene, i have a vera in my office, i have 2 thermostat, each for individuals A/C,
what i am trying to accomplish is to turn on the 2nd A/C, from 11:00 AM- 3:00PM but only if the 1st A/C is in cool state (this basically will mean that im currently at the office). i would like to know if this can be done with a luup code and if so, how can this be done??

regards

Start with this example http://forum.micasaverde.com/index.php/topic,18679.msg142005.html#msg142005 but look for the themostat mode instead of temp range instead.

Pretty simple in PLEG

Input Schedule
OfficeTime - On at 11:00 EveryDay (or maybe just M-F)
Off at 3:00 EveryDay

Input Device Property
MasterMode - ModeTarget from thermostat that is in your office
SlaveMode - ModeTarget from thermostat that is in other office

Condition:
TrackChange - (MasterMode ne SlaveMode) and OfficeTime
Off !OfficeTime

Actions:
TrackChange - Initially Set thermostat to off
Then go into the Advanced mode and change Off to {(MasterMode)}
Off - Set thermostat to off

[hr]
What this does is the following:

  1. Every day at 3:00 PM it turns the second thermostat to OFF
  2. Every day between 11:00 AM and 3:00 PM any change to the Operating mode in your office is automatically made to the second thermostat.