One may turn on lights before Shabbat and set a timer (“Shabbos clock”) to turn them off and then back on at the desired times. Similarly, one may use a timer to turn on an electric oven or fan, setting it so that the appliance will go on and off at the desired times.
If there is a need on Shabbat to change the start or end times, one may rely on the opinion of those who allow extending the current situation, but not shortening it. In other words, when the light is on, the timer may be adjusted to make the light stay on for longer, but may not be adjusted to make it turn off earlier. When the light is off, one may adjust the timer so that the light will stay off for longer, but not so that it will come back on sooner. In times of need, such as for someone who is sick, adjustments may be made which will make the light go on or off earlier, as doing so is grama, which is permitted on Shabbat only in pressing circumstances (Peninei Halakha: Shabbat 17:6 and n. 7).
Two factors allow for greater leniency on Yom Tov. First, lighting a fire on Shabbat violates a Torah prohibition, whereas on Yom Tov the prohibition is rabbinic (section 1 above). Additionally, according to most poskim, grama on Shabbat is permitted only in pressing circumstances, whereas on Yom Tov it is permitted for any need at all. Therefore, as long as there is some need, one may move the time forward on a timer. If a light is on, the timer may be adjusted so that the light will go off earlier; if the light is off, the timer may be adjusted to make it turn on earlier. Similarly, if there is any need, one may cause an oven to go on earlier by adjusting the timer – i.e., with a timer as long as it will not turn on for at least five minutes following the adjustment. As long as there is an external device with such a time delay, it is considered grama (Tzitz Eliezer 1:20:5; see SSK 13:31).[9]