![]() | ![]() |
The term logic here means something a little different from Mr. Spock's definition. The easiest way to explain it is to compare it to a learning remote that many people may have used. You can set up a learning remote control to learn the commands from your other remote controls. You can then have it spit out a sequence of those commands one by one at the press of a single button. This is a form of automation, in that you've automated a sequence of steps. But, it's very simplistic in that it cannot make decisions based on the status of the devices under control.
Automation logic can be that simple if there's no need to do more. But often you want more than a simple sequence of steps. For instance, if your projector goes off and does a wierd little flickering dance every time it gets a particular command, it would be nice not to send it that command if it is already in the right mode. Or some devices might require a period of time after you ask them to do something before they can accept more commands, so it would be nice to know if it's already in that state and skip the pause so as speed up the process. Or you might provide a button on a touch screen to turn on the outside lights, but if it's daytime you might want to ask the user if they really want to do this.
All of these smarter types of automated sequences of steps require 'If' or 'If/Else' type checks. If it's daytime, then ask the user if they really want to turn the outside lights on, else don't. If the device isn't in the required state, then put it in that state and wait for the required time for it to be ready for use, otherwise don't do anything for that step. This type of 'conditional operation' is at the heart of all software and is a very simple form of software programming. And it's generally referred to as logic, from the more general term 'boolean logic', where boolean refers to things that are true or false. So you are creating logic based on If statements that check if something is true or if something is false.