Take a look at the automation station thread. Starts with wiring a system. To programming it. With both sides of the pond covered and pretty much everywhere in-between.
@reikox is spot on. You only need internet to set it. Once its set it stays as is.
@esrgood4u you can set the sonoff up to resume state before power outage mate. Saves that headache