One of the challenges of building a great home automation system that does the right thing all the time without you needing
to tell it what to do is the problem of figuring out what state the house is in.
Some of the many possible states include:
Not occupied and the residents are out for the evening
Not occupied and the residents have gone on vacation
Occupied but everyone is asleep
Occupied and there are dinner guests
Occupied and there is a party going on
Occupied and there are guests staying over
States might affect how long the heating stays on for, whether the driveway lights are left on or whether they go off once everyone is home.
In order to recognize the correct state a home automation system needs many different sensor inputs. My own home has over 200 sensors including door sensors, motion sensors, driveway sensors, under-floor strain-gauges and IR beams. It also uses WIFI-sniffing to detected the coming and going of mobile phones and other mobile devices that connect to WIFI.
I've been working on home automation for over 15 years and I'm close to achieving my goal which is a house that understands where everyone is at all times, can predict where you are going next and can control lighting, heating and other systems without you having to do or say anything. That's a true "smart home".
An overview of the many sensors I've experimented with for home automation including my favorite under-floor strain gauge, through all the usual PIR, beam and contact sensors to some more esoteric devices like an 8x8 thermal camera.
An if-this-then-that style rules machine is insufficient for lighting control. This state machine accomplishes 90% of the correct behavior for a light that is controlled automatically and manually in a home automation system.