Another common requirement for logic is "corridor linking". In this case, there are a series of offices or rooms sharing a corridor. The corridor light needs to be on while any of the office lights are on, and switch off soon after the last light goes off. For a simple case of only two offices, the code is : [CODE] { constants } CorridorGroup = 5; Office1Group = 1; Office2Group = 2; { module code } { Switch Corridor on if ANY offices are on } once (GetLightingState(Office1Group) = ON) or (GetLightingState(Office2Group) = ON) then SetLightingState(CorridorGroup, ON); { Switch corridor off if ALL offices are off} once (GetLightingState(Office1Group) = OFF) and (GetLightingState(Office2Group) = OFF) then begin Delay(30); if (GetLightingState(Office1Group) = OFF) and (GetLightingState(Office2Group) = OFF) then SetLightingState(CorridorGroup, OFF); end; [/CODE] The important factor in the code above is to check that the office lights are still off at the end of the delay, in case someone switched a light back on again during the delay period. If you need more offices, you can just add them to the condition statements. If you have a lot of offices (more than 3 or 4), this can start to get messy. A simpler way to handle this is to create a Scene which contains all of the Office groups. The groups in this Scene can be manipulated as a set using various logic functions. For example, if you have a Scene called "Offices" containing the Group Addresses for all of the offices along a corridor (the levels in the Scene do not matter), you could use the function : [CODE] GetSceneMaxLevel("Offices") [/CODE] to determine the maximum level of the Groups in the Scene. If this level is 0, then all Groups are off. If this level is greater than 0, then at least one group is on. This can be applied to the corridor linking example as follows : [CODE] { constants } CorridorGroup = 5; { module code } { Switch Corridor on if ANY offices are on } once GetSceneMaxLevel("Offices") > 0 then SetLightingState(CorridorGroup, ON); { Switch corridor off if ALL offices are off} once GetSceneMaxLevel("Offices") = 0 then begin Delay(30); if GetSceneMaxLevel("Offices") = 0 then SetLightingState(CorridorGroup, OFF); end; [/CODE] See the Corridor Linking example provided with the software to see an example of this operating.