What is the magic that makes home automation work so spectacularly? Well, it has about as much "magic" as Disney's Magic Kingdom does. In other words, its really huge amounts of science, engineering and technology operating at breathless speed!
You press a button that you named "Good Morning." At that one touch, your bathroom vanity lights and heater turn on to a pre-set level just right for you, your dressing room light turns on, shades slowly rise to let in morning light, interior lights gently fade on, your preferred morning show turns on so you can catch your favorite music or else the morning headlines and your security system is disarmed so you can step out onto the back patio without having to squint at a keypad.
What's going on here? The brain of the control system (the CPU) recognizes the button you pressed and instantly processes complex commands to activate specific strings of code simultaneously to each of the sub-systems (lighting, climate control, motorized shades, security, etc.) telling them what to do nearly instantly.
Now each manufacturer of their respective systems provides an app for their product. But consider the following.