Disclosed is apparatus for controlling devices comprising a data structure
representing devices to be controlled; means for controlling the state of the device
controller; means for dynamically determining the current sub-state within a state
of the device controller; means for controlling the physical state of a controlled
device; and a rules database having rules to be executed by the apparatus, the
rules database having rules corresponding to a plurality of states and sub-states
of said device controller.